AbePralle / JValue

A lightweight, robust, and full-featured Java library for managing JSON-style data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JValue

v1.0.2 - January 16, 2019

Overview

JValue is a lightweight, robust, and full-featured Java library for managing "JSON-style" data as well as serializing to and from JSON. It is adapted from the Rogue Language "Value System".

JValue uses the permissive MIT License.

Examples

JValue data = JValue.table();
JValue names = data.ensureList( "names" );
names.add( JValue.table().set("first","Abe").set("last","Pralle") );
names.add( JValue.parse( "{\"first\":\"April\",\"last\":\"Lee\"}" ) );
names.save( new File("Data.json") );
...

JValue data  = JValue.load( new File("Data.json") );
JValue names = data.get( "names" );
for (int i=0; i<names.count(); ++i)
{
  JValue name = names.get( i );
  if ( !name.contains("full") )
  {
    name.set( "full", name.get("first").toString() + " "  + name.get("last").toString() );
  }
}
System.out.println( names.toJSON() );

About

A lightweight, robust, and full-featured Java library for managing JSON-style data.

License:Other


Languages

Language:Java 100.0%