BHoM_Engine
BHoM_Engine copied to clipboard
Serializer_Engine: PrettyPrint json when exposed to UI
Using mongo drivers
obj.ToJson(new JsonWriterSettings { Indent = true });
It would help a lot for debugging, instead of using Explode
Having reviewed this historic issue, I think it is worth still having this for some application. However, I don't think it should be part of the ToJson method (which now isn't using the things suggested in the original issue since the updates to Serialiser_Engine in early 2023) because that is used internally for several things where pretty printing the output string isn't relevant.
Instead, to resolve this, I propose a new method which takes in a JSON string and returns a formatted version which becomes human readable which can then be used in UIs as desired. It adds another component to the process, but keeps the ToJson method focused on generating the JSON and not worrying about its display for human or computer use.