Formatted json?

NodeCanvas Forums General Discussion Formatted json?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12694
    akyangliao
    Participant

    Right now the _serializeGraph is just one giant string and can’t not be viewed for difference. This is kind of bad for source control. So is it possible format the json like this?

    #12704
    Gavalakis
    Keymaster

    Hello,

    Even if it is possible for the json to be formatted like this as you know, the problem is that Unity will still serialize the string in it’s YAML format, as a long string, but rather this time with “\r” everywhere, like this: line1\r\nline2\r\nline3\r\nā€¦ .

    This is really something I would want to make it work like you suggest, but I can’t seem to find any way to tell Unity to keep the string nicely formatted, if even possible at all :/

    Join us on Discord: https://discord.gg/97q2Rjh

    #13460
    yauheni
    Participant

    We have a simple solution that can help. Firstly, you have to enable pretyJson in Graph.cs (_serializedGraph = this.Serialize(true, _objectReferences);). Secondly, in fsJsonPrinter.cs replace this lines(stream.WriteLine();) with this (stream.Write(“\n”)). This will make you Json string more readable. But you have to comment all this lines(InsertSpacing(stream, depth);). We could not combine spacings with new lines correctly. Maybe you can do it. Hope this helps.

    #13463
    Gavalakis
    Keymaster

    Hello,

    Thank you!
    I will check your solution out as soon as possible and update this thread šŸ™‚

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.