antology 2.0.7
Task

<jsonProperty>

Sets a number of properties according to the JSON document read from a file, in analogy with the standard <xmlproperty> ANT task.

Property setting schema

Objects

If the document contains a JSON object ("{ "name1": "value1", "name2": "value2" }"), then properties are set as follows:

 name.name1 = value1
 name.name2 = value2

Notice: If a JSON object does not only contain string values, then the property names are formed by applying the rules recursively.

Arrays

If the document contains a JSON array ("[ "elem0", "elem1" ]"), then properties are set as follows:

 name.0 = elem0
 name.1 = elem1

Notice: If a JSON array does not only contain string values, then the property names are formed by applying the rules recursively.

Notice: If the array size is 10 or greater, then the array index parts of the property names are left-padded with zeros for equal width. E.g. if the array size is 1000, then the property names are name.000 through name.999.

Strings, Numbers, Booleans, null

If the document contains a string, number, boolean or null value, then a property is set as follows:

 name = value

Example

 {
    "name1": "value1",
    "name2": null,
    "name3": true,
    "name4": [
       "elem0",
       { "name1": "value1", "name2": "value2" },
       [ "elem0", "elem1" ]
    ],
    "name5": 1.0000,   <= Will be scanned as a DOUBLE because in contains at least one of ".eE".
    "name6": 0100
 }

results in the following properties being set (assuming that property "name" has value "acme"):

 acme.name1 = value1
 acme.name2 = null            <= Notice that the value is indistinguishable from the string value "null".
 acme.name3 = true            <= Notice that the value is indistinguishable from the string value "true".
 acme.name4.0 = elem0
 acme.name4.1.name1 = value1
 acme.name4.1.name2 = value2
 acme.name4.2.0 = elem0
 acme.name4.2.1 = elem1
 acme.name5 = 1.0             <= Notice that the DOUBLE was normalized.
 acme.name6 = 100             <= Notice that the integer was normalized.
antology 2.0.7

Copyright © 2019. All rights reserved.