flightcontrolhq / superjson

Safely serialize JavaScript expressions to a superset of JSON, which includes Dates, BigInts, and more.
https://www.flightcontrol.dev?ref=superjson
MIT License
4.13k stars 91 forks source link

docs: add reference to next-json in prior art section #217

Closed iccicci closed 1 year ago

iccicci commented 1 year ago

Hi all,

I see there is a mutual support between libraries related to this topic. I would kinly ask to accept my mutual reference as well.

Thank you

Skn0tt commented 1 year ago

Hi @iccicci! The prior art section is meant to attribute projects that inspired SuperJSON - so I can't add next-json to that list, I'm afraid.

Could you elaborate on the benefits / drawbacks of next-json compared to SuperJSON? Maybe we can reference it in the README with a sentence "if you have problem XYZ, maybe try next-json".

iccicci commented 1 year ago

Hi @Skn0tt, probably the description (Other libraries that aim to solve a similar problem) misled me...

I thought about it as the See also section in devalue.

Apart from many features of next-json are still WIP, it offers an API interface similar to the JSON and SuperJSON ones, but it produces a serialized string which is JavaScript compliant (as devalue and serialize JavaScript do) offering its own parser, which means the output can be deserialized without using the security hole implied by eval.

Skn0tt commented 1 year ago

That's definitely interesting! Let me know once all the WIP stuff is implemented, and i'll give next-json another look and potentially recommend it in the README :)

iccicci commented 1 year ago

Thank you! I'll do

iccicci commented 1 year ago

Hi @Skn0tt , please let me bother you with a small update. All next-json's basic functionalities are now implemented. Errors and circular references are still missing, but probably they can be considered nice to have...

iccicci commented 1 year ago

Thank you very much @Skn0tt ! Really appreciated

Skn0tt commented 1 year ago

Thx for keeping me up-to-date @iccicci! I've had a look at next-json's codebase, and really like the parser-generator-based approach, and the fact that the generated JSON is both easy to read (since being JS-compliant) but still can be parsed without eval. You should add that to the README, that's a really thoughtful design! I've added it to SuperJSON's list :)

iccicci commented 1 year ago

Thank you for the suggestion as well @Skn0tt . Avoiding the use of eval is actually one of the reasons why I decided to write next-json so that is something I didn't care about enough. I've added a dedicated paragraph in the README, more some ather references to this.