UNEXPECTED END OF JSON INPUT IN LINE 1

167 views
Skip to first unread message

Samuel Victor

unread,
Sep 21, 2025, 10:36:46 AMSep 21
to DroidScript
Good day fam ❤️
I came across a fatal error on two projects I have in DroidScript. All of a sudden, they were unable to run successfully and I haven't touched the code base in while.
I get the error "Unexpected end of JSON INPUT in line 1" when I check - it's completely unrelated to the error itself.
The code works fine, as it used to. Just this error that came up recently.
I feel like it's DroidScript itself rejecting these projects.
Any help would be highly appreciated 👍 ❤️

Best Regards,

Dave

unread,
Sep 22, 2025, 1:53:07 PMSep 22
to DroidScript
We need to narrow down which bit of code is causing it.  Please make a copy of your app and then cut out chunks of code until you have a very simple bit of code that still shows the problem, then post it here.

Samuel Victor

unread,
Sep 23, 2025, 10:06:18 AMSep 23
to DroidScript
I can't exactly spot where the problem comes from two projects I haven't touched in a while. Each project code has about 1-2k lines of code. But the error points to line 1 and there's nothing related there. Here are pictures Screenshot_20250923-144807.pngScreenshot_20250923-145042.png

Samuel Victor

unread,
Sep 23, 2025, 1:34:14 PMSep 23
to DroidScript
The crypt object in DroidScript for encryption when called to encrypt returns a different cipher text from crypt.Encrypt("string");
I now later realized that crypt=app.CreateCrypt(without any parameters); when declared behaves exactly like this but sometimes decrypt successfully. I realized they recently added 'AES or ECB or PKCS5 padding as parameters optional' I decided to stick with AES and the problems I encountered stopped. It seems this was an update to the crypt object. I have fixed the problem successfully but can anyone explain why?

Dave

unread,
Sep 24, 2025, 1:19:51 PMSep 24
to DroidScript
The cryipt object now uses "AES/GCM/NoPadding" because Google Play developer console keeps warning you if you continue using the old AES/ECB/PKCS5Padding as it is considered insecure these days.  So we updated the default method, but if you have previously encrypted content, you will need to pass the "AES/ECB/PKCS5Padding" option to decrypt that older stuff.

If you mix the two worlds, then you need to mark/record that the newer content uses the newer method.

Samuel Victor

unread,
Oct 3, 2025, 9:15:39 AMOct 3
to DroidScript
Thanks for letting me know sir. But I tried the new parameters, I know traditional AES GCM requires a salt but i tried it out for a small test. 
The picture below shows the plaintext being encrypted with two crypt objects one having the old parameters and the other having the new GCM one. The ciphertext for the GCM mode always changes for every encryption maybe because of the salt (I did not add any salt either, the crypt object seems to generate one itself, hidden) but when decrypting the ciphertext (GCM mode) with the crypt object supporting GCM, it returns an empty string and prints and error on the console "crp.Decrypt) failed! (Java.security.InvalidAlgorithmParameterException: 
IV must be specified in GCM mode)"
It seems it needs the IV - salt for decryption, but during encryption it seems to generate its own salt - although it doesn't show it, ciphertext is always different.
I'm confused, any help would be highly appreciated.1759497235747.png

Samuel Victor

unread,
Oct 22, 2025, 3:09:30 AMOct 22
to DroidScript
Good day fam!
I still haven't gotten a response on this issue with the Crypt object in Droidscript
Please any suggestions would be welcome
Reply all
Reply to author
Forward
0 new messages