Wraps a JSON data structure in a Map-like interface, with additional utilities for retrieving data from nested paths and for handling array data.

Static methods

staticinlinebuild():JSONData

staticinlinebuildArray():JSONData

staticinlinebuildObject():JSONData

staticinlinecopy(this:Dynamic):Null<JSONData>

Returns a shallow copy of the structure

staticinlineexists(this:Dynamic, key:String):Bool

Tells if the data contains a specified key.

Returns:

true if the key is present, false otherwise.

staticexistsByPath(this:Dynamic, path:String):Dynamic

Query existance of an element of the JSON data by a normalized JSONPath.

@:arrayAccessstaticinlineget(this:Dynamic, key:String, ?defaultValue:Dynamic):Null<Dynamic>

Returns a value by specified key. Can be used like jsonData["key"]

Returns:

The value, or the defualt if the key is not present. Can return null if the value was present but null.

staticgetByPath(this:Dynamic, path:String):Null<Dynamic>

Get an element of the JSON data by a normalized JSONPath. If you want to perform a query using an actual JSONPath, use JSONPath.query() instead.

staticinlinegetData(this:Dynamic, key:String):Null<JSONData>

Returns a value as JSONData.

@:value({ strict : false })staticinlineinsert(this:Dynamic, key:String, value:Dynamic, strict:Bool = false):Dynamic

@:value({ strict : false })staticinlineinsertByPath(this:Dynamic, path:String, value:Dynamic, strict:Bool = false):Dynamic

Insert an element into the JSON object/array by a normalized JSONPath.

staticinlineisArray(this:Dynamic):Bool

Returns:

true if this JSON is an array, false if it is an object

staticinlineisObject(this:Dynamic):Bool

Returns:

true if this JSON is an object, false if it is an array

staticinlineisPrimitive(this:Dynamic):Bool

staticinlinekeys(this:Dynamic):Array<String>

Returns an array of keys in the data.

staticinlinelength(this:Dynamic):Int

staticinlineparse(input:String):JSONData

staticinlineremove(this:Dynamic, key:String):Bool

Removes a specified key in the data.

Returns:

true if key was present in structure, or false otherwise.

staticremoveByPath(this:Dynamic, path:String):Dynamic

Remove an element of the JSON data by a normalized JSONPath.

@:arrayAccessstaticinlineset(this:Dynamic, key:String, value:Dynamic):Dynamic

Sets a value for a specified key. Can be used like jsonData["key"] = value

Returns:

The value provided, or null if the key is not present.

staticinlinesetByPath(this:Dynamic, path:String, value:Dynamic):Dynamic

Set an element of the JSON data by a normalized JSONPath.