Open capital-G opened 1 year ago
there's btw. also the (rather minimal) JSON implementation of the FluCoMa peeps: https://github.com/flucoma/flucoma-sc/blob/main/release-packaging/Classes/FluidManipulationJSON.sc (but it doesn't really help in the prettyprint issue :) )
so maybe just copy the python behavior as it seems to cover pretty much anything?
yes, looks reasonable.
@LFSaw suggested that having a pretty printer for the object to string method would be nice and I agree - I used vscode multiple times to make the JSON look more convenient during debugging, and after all, JSON is a human readable format and its reference implementation in JavaScript also offers this feature natively.
Examples
I looked up the JS and the Python implementation and they both offer adding an indentation in their "transform object to string" method
JavaScript:
JSON.stringify
Python:
json.dumps
Implementation: https://github.com/python/cpython/blob/ffb41eaaf4b04f7f52ee095253fcc1c5ba62ca28/Lib/json/encoder.py#L288-L295
I don' t really understand the length of 10 restriction in JS, so maybe just copy the python behavior as it seems to cover pretty much anything?