Converting to and from JSON - Mrcarrot1/KarrotObjectNotation GitHub Wiki
As of KON 1.0, the library supports parsing from and writing to JSON files.
Note that not all JSON can be parsed into KON as KON's syntax is somewhat stricter. JSON strings that have an array as the root, contain nodes or arrays within arrays, or fall into some other edge cases will not work correctly. As such, some manual manipulation of JSON strings may be necessary. If you require a library that can easily parse all valid JSON, this is not the library for you. However, all valid KON can be written to valid JSON.
To read from a JSON string, the methods KONParser.ParseJSON
and KONParser.TryParseJSON
are available. These output KONNode
s, which may be used in exactly the same way as nodes read from KON. This includes writing to either KON or JSON.
To write to a JSON string, the method KONWriter.WriteJSON
is available. It outputs a JSON string. This method may be used with a node read from either KON or JSON.
To configure how JSON is written by the writer, use settings on the KONWriterOptions
object.