Friday, 12 May 2017

Combine 2 JSON files into 1 file in Node or Python (i.e. longitude and latitude)

I want to append the longitude to a latitude stored in 2 separated json files

The result should be stored in a 3rd file

How can I do that on Python OR Javascript/Node?

Many thanks for your support,

LATITUDE

{
    "tags": [{
        "name": "LATITUDE_deg",
        "results": [{
            "groups": [{
                "name": "type",
                "type": "number"
            }],
            "values": [
                [1123306773000, 46.9976859318, 3],
                [1123306774000, 46.9976859319, 3]
            ],
            "attributes": {
                "customer": ["Acme"],
                "host": ["server1"]
            }
        }],
        "stats": {
            "rawCount": 2
        }
    }]
}

LONGITUDE

{
    "tags": [{
        "name": "LONGITUDE_deg",
        "results": [{
            "groups": [{
                "name": "type",
                "type": "number"
            }],
            "values": [
                [1123306773000, 36.9976859318, 3],
                [1123306774000, 36.9976859317, 3]
            ],
            "attributes": {
                "customer": ["Acme"],
                "host": ["server1"]
            }
        }],
        "stats": {
            "rawCount": 2
        }
    }]
}

Expected result: LATITUDE_AND_LONGITUDE

{
    "tags": [{
        "name": "LATITUDE_AND_LONGITUDE_deg",
        "results": [{
            "groups": [{
                "name": "type",
                "type": "number"
            }],
            "values": [
                [1123306773000, 46.9976859318, 36.9976859318, 3],
                [1123306774000, 46.9976859319, 36.9976859317, 3]
            ],
            "attributes": {
                "customer": ["Acme"],
                "host": ["server1"]
            }
        }],
        "stats": {
            "rawCount": 2
        }
    }]
}



via Abdelkrim

No comments:

Post a Comment