JSON
classin packageklyn.io.json
public class JSON
JSON

JSON utility entry-point.

Notes:

  • Native parsing/serialization is used for performance.
  • File and reader/writer workflows are handled in Klyn wrappers.
Methods
Modifier and Type Member Description
public static parse
parse(notnull json as String) as Object
Parses JSON text into its natural Klyn representation.
public static parse
parse<TYPE>(notnull json as String) as TYPE
Parses JSON text using the explicitly requested static type.
public static parseList
parseList(source as Object) as ArrayList<Object> throws IOException
Parses JSON array from a string, a reader or a file.
public static parseMap
parseMap(source as Object) as SortedMap<String, Object> throws IOException
Parses JSON object from a string, a reader or a file.
public static stringify
stringify(filename as String, value as Object, spaces as Boolean = true, pretty as Boolean = false, indent as Int = 0) as String throws JSONWriteException, IOException
Serializes a value and writes it to a file named by a string.
public static stringify
stringify(notnull writer as TextWriter, value as Object, spaces as Boolean = true, pretty as Boolean = false, indent as Int = 0) as String throws JSONWriteException, IOException
Serializes a value and writes it to a text writer.
public static stringify
stringify(path as Path, value as Object, spaces as Boolean = true, pretty as Boolean = false, indent as Int = 0) as String throws JSONWriteException, IOException
Serializes a value and writes it to a path.
public static stringify
stringify(value as Object, spaces as Boolean = true, pretty as Boolean = false, indent as Int = 0) as String throws JSONWriteException
Serializes a value as JSON.