harmony-jolt 0.6.0

JSON to JSON transformation library using the JOLT spec
Documentation
{
    "input": {
        "data1": {
            "value": -2
        },
        "data2": {
            "value": -2.0
        },
        "data3": {
            "value": [-1,2,3.0]
        },
        "data4": {
            "value": [5, 2],     // Divide 2 integers returning double
            "test1": [5, 2.0],   // Divide integer and double returns double
            "test2": [5, 0],     // Divide by 0 returns empty hence noop
            "test3": [0, 5],     // Divide 0 by any number returns 0
            "nr": 51,
            "dr": 13
        },
        "data5": {
            "aInt" : 10,
            "bInt" : 3,
            "aDouble" : 10.0,
            "bDouble" : 3.0
        }
    },

    "spec": {
        "data1": {
            "max": "=max(@(1,value) , ^value,0)",
            "min": "=min(@(1,value) , ^value,0.0)",
            "double": "=toDouble(@(1,value))",
            "value": "=abs",
            "intSum": "=intSum",  // Noop. Sum is a list function. Single arg is being passed here.
            "doubleSum": "=doubleSum"
        },
        "data2": {
            "max": "=max(@(1,value) , ^value,0.0)",
            "min": "=min(@(1,value) , ^value,0)",
            "integer": "=toInteger(@(1,value))",
            "value": "=abs"
        },
        "data3": {
            "min": "=min(@(1,value))",
            "max": "=max(@(1,value))",
            "int": "=toInteger(@(1,value))",
            "double": "=toDouble(@(1,value))",
            "abs": "=abs(@(1,value))",
            "intSum": "=intSum(@(1,value))",
            "doubleSum": "=doubleSum(@(1,value))",
            "longSum": "=longSum(@(1,value))",
            "value": "=intSum"
        },
        "data4": {
            "test1": "=divide",
            "test2": "=divide",
            "test3": "=divide",
            "explicit1": "=divide(@(1,value))",
            "explicit2": "=divide(12,3)",
            "div": "=divide(@(1,nr),@(1,dr))" ,  // Look up the numerator and denominator from the input
            "roundedDiv": "=divideAndRound(4, @(1,nr),@(1,dr))",   // Round the result to the 4 decimal points
            //
            "badArgs1" : "=divide(1,2,3)", // too many params
            "badArgs2" : "=divide(1)"      // not enough params
        },
        "data5": {
            "happyInt":       "=intSubtract(@(1,aInt),@(1,bInt))",
            "happyDouble": "=doubleSubtract(@(1,aDouble),@(1,bDouble))",
            //
            // Bad Args
            "badArgsInt1": "=intSubtract(1)",     // not enough args
            "badArgsInt2": "=intSubtract(1,2,3)", // too many args
            "badArgsDouble1": "=doubleSubtract(1)",    // not enough args
            "badArgsDouble2": "=doubleSubtract(1,2,3)" // too many args
        }
    },

    "context": {
        "value" : 1.0
    },

    "OVERWRITR": {

        "data1" : {
            "max" : 1.0,
            "min" : -2,
            "double" : -2.0,
            "value" : 2
        },
        "data2" : {
            "max" : 1.0,
            "min" : -2.0,
            "integer" : -2,
            "value" : 2.0
        },
        "data3" : {
            "min" : -1,
            "max" : 3.0,
            "int" : [ -1, 2, 3 ],
            "double" : [ -1.0, 2.0, 3.0 ],
            "abs" : [ 1, 2, 3.0 ],
            "intSum" : 4,
            "doubleSum" : 4.0,
            "longSum" : 4,
            "value": 4
        },
        "data4": {
            "test1": 2.5,
            "test2": [5, 0],
            "test3": 0.0,
            "div": 3.923076923076923,
            "roundedDiv":3.9231,
            "explicit1": 2.5,
            "explicit2": 4.0,
            "value": [5, 2],
            "nr": 51,
            "dr": 13
        },
        "data5": {
            // og data
            "aInt" : 10,
            "bInt" : 3,
            "aDouble" : 10.0,
            "bDouble" : 3.0,
            //
            // computed
            "happyInt": 7,
            "happyDouble": 7.0
        }
    }
}