Macaulay2 » Documentation
Packages » JSON :: JSON
next | previous | forward | backward | up | index | toc

JSON -- JSON encoding and decoding

Description

JSON (JavaScript Object Notation) is a common data interchange format. This package provides two methods, toJSON and fromJSON, for converting Macaulay2 things to valid JSON data and vice versa.

i1 : toJSON {hashTable{"foo" => "bar"}, 1, 3.14159, true, false, nil}

o1 = [{"foo": "bar"}, 1, 3.14159, true, false, null]
i2 : fromJSON oo

o2 = {HashTable{"foo" => bar}, 1, 3.14159, true, false, nil}

o2 : List

Author

Version

This documentation describes version 0.3 of JSON.

Source code

The source code from which this documentation is derived is in the file JSON.m2. The auxiliary files accompanying it are in the directory JSON/.

Exports

  • Functions and commands
    • fromJSON -- decode JSON data into Macaulay2 things
    • toJSON -- encode Macaulay2 things as JSON data
  • Methods
    • fromJSON(File) -- see fromJSON -- decode JSON data into Macaulay2 things
    • fromJSON(String) -- see fromJSON -- decode JSON data into Macaulay2 things
    • toJSON(Thing) -- see toJSON -- encode Macaulay2 things as JSON data
  • Symbols
    • nil (missing documentation)
    • Indent -- see toJSON -- encode Macaulay2 things as JSON data
    • NameSeparator -- see toJSON -- encode Macaulay2 things as JSON data
    • ValueSeparator -- see toJSON -- encode Macaulay2 things as JSON data

For the programmer

The object JSON is a package.