Get a Flatten JSON Dump


ASTER::EXPRESSION::JSON::Get a flatten Dump using JSON Pointer

Get a flattened dump string of the data structure.

ExStrFlatDump( "ASTER", "/MarcCohn/WalkingInMemphis" )

Parameter : JSON Pointer

If a non-existent path is specified as a parameter, an error message is displayed.

In the case of ignoring error notifications settings, errors will not be displayed, and if a specific action for the error is necessary, the immediate execution condition " JSON Pointer Error" can be utilized.

Rule Param
Obtain a JSON dump from the specified location. “/test”
If an empty string is entered, it is considered as root. ""
If a single character is entered, it is considered as root. “a”

Parameter 2 : Noone

Indentation using whitespace is fixed at the set indent of 4 and cannot be changed.


About Flatten

Reference URL : nlohmann::basic_json::flatten

Obtains a dump of the JSON data currently deployed in memory, converting all data structure types included in the path specified by JSON Pointer to Primitive type.

About Primitive Types

RFC 8259 Section-1 :: Introduction defines the following four as the “primitive types” of JSON.

  • Strings
  • Numbers
  • Booleans
  • Null

However, the nlohmann/json library has its own support for including Binary in primitives.

JSON defines objects and arrays as data structures, and flattening converts data structures into primitive types.

An example is shown below.

{
    "object":{
        "a":100,
        "B":200
    },
    "test":{
        "array":[
            "J",
            "S",
            "O",
            "N"
        ]
    }
}

Flattening the above JSON results in the following Dump.

{
    "/object/a":100,
    "/object/b":200,
    "/test/array/0":"J",
    "/test/array/1":"S",
    "/test/array/2":"O",
    "/test/array/3":"N"
}

All data structure types can be converted to primitive types by Flatten, and the conversion results in the exclusion of hierarchical data structures from the JSON data.