One-File JSON Parser


One-file JSON Parser can parse JSON in a single file, ItsJsonParser.cs.

...


by Hammer Solves Everything


Price History +

One-file JSON Parser can parse JSON in a single file, ItsJsonParser.cs.

You can easily use, copy, modify, reproduce, transmit, and distribute the software.


Feature

  • Parse JSON string to class
  • Parse class to JSON string

Details

  • Nested classes and structs can be parsed
  • Nested Arrays and Lists can be parsed
  • Enum variables can be parsed as name
  • Nullable variables can be parsed (when not null)
  • SerializeField and NonSerialized attributes can be used to mark as parse target

Example

To JSON text from Class

FooClass foo = new FooClass();

string jsonText = ItsJsonParser.ToJson(foo);


From JSON text to Class

string jsonText = "{"foo":1, "bar":"baz"}";

FooClass foo = ItsJsonParser.FromJson<FooClass>(jsonText);