JSON encoding / decoding for LiveCode only with livecode-script

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

JSON encoding / decoding for LiveCode only with livecode-script

Post by andresdt » Mon Dec 14, 2020 10:11 pm

Hello community
Next, we share the PhotonJSON library.
It arose from the need to have a sufficiently powerful library, with great portability and that would follow all the standards established in ECMA-404.
This library, in addition to having the previous characteristics, is written 100% in LiveCode script.

https://ferruslogic.com/photonjson-v1-0-4-released
https://github.com/Ferruslogic/PhotonJS ... tag/v1.0.4
Last edited by andresdt on Mon Jan 25, 2021 7:45 pm, edited 2 times in total.

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: JSON encoding / decoding for LiveCode only with livecode-script

Post by bwmilby » Tue Dec 15, 2020 3:09 pm

I’ve opened a few minor issues there. I can submit one or multiple PRs if needed (edits needed are very simple). Thanks for posting this code.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

Re: JSON encoding / decoding for LiveCode only with livecode-script

Post by andresdt » Wed Dec 16, 2020 2:12 am

Thank you very much bwmilby! The details are already fixed.

bhall2001
Posts: 107
Joined: Thu Oct 30, 2014 3:54 pm
Location: Manchester, NH

Re: JSON encoding / decoding for LiveCode only with livecode-script

Post by bhall2001 » Mon Jan 04, 2021 10:55 pm

Can't wait to try this out. Just did a quick review of the code and looks great. Nice work!

Bob

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

Re: JSON encoding / decoding for LiveCode only with livecode-script

Post by andresdt » Tue Jan 05, 2021 3:04 pm

bhall2001 wrote:
Mon Jan 04, 2021 10:55 pm
Can't wait to try this out. Just did a quick review of the code and looks great. Nice work!

Bob
Thank you very much, we hope it will be very helpful.

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

Re: JSON encoding / decoding for LiveCode only with livecode-script

Post by andresdt » Thu Dec 02, 2021 2:45 pm

Hi everyone
We have updated the PhotonJSON library, these are the changes that the new version has.

• In this version of the library, functions that were deprecated are removed. Which makes it no longer compatible with LiveCode versions lower than 7. Thanks to @Monox18 https://github.com/Ferruslogic/PhotonJSON/issues/5 for the suggestion
• The functions that were used to detect the encoding of the input string are removed, since this string must be a UTF-8 string.
• The beautifyJSON() function is removed, because with the JSONStringify() function you can format JSON very well.

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

Re: JSON encoding / decoding for LiveCode only with livecode-script

Post by andresdt » Thu Jan 20, 2022 6:13 pm

Hi, livecoders
Version 1.2.0 of the PhotonJSON library has been released with the following changes.
  • When converting a JSON string to a LiveCode array, empty Javascript objects and arrays are no longer converted to plain empty variables. They are now converted to their LiveCode equivalent, so that the type is not lost when converting the LC Array to JSON again.
  • The "" are replaced by null when converting from array to JSON. This is for compatibility with the ECMA-404 standard.
https://github.com/Ferruslogic/PhotonJS ... tag/v1.2.0
https://ferruslogic.com/product/PhotonJSON

Post Reply

Return to “CGIs and the Server”