Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Jolt Specification to complex structure

avatar
New Contributor

Hi,

I've got an INPUT-json that looks like this:

{
"vendor" : "myINC",
"beginTime" : "2020-01-21T10:00:00+08:00",
"userLabel" : "DB",
"Types" : [ {
"Name" : "type001",
"subTypes" : [ {
"subtype003" : {
"counter1" : "0",
"counter5" : "0",
"counter54" : "0"
}
},{
"subtype001": {
"counter002": "0",
"counter5": "0",
"counter65": "0"
}
} ]
}, {
"Name" : "type002",
"subTypes" : [ {
"subtype006" : {
"counter1" : "0",
"counter5" : "0",
"counter54" : "0"
}},{
"subtype009" : {
"counter002": "0",
"counter5": "0",
"counter65": "0"
}
}]
} ]
}

 

and would need a OUTPUT-json like this:

 

{
"vendor" : "myINC",
"beginTime" : "2020-01-21T10:00:00+08:00",
"userLabel" : "DG",
"Types" : [ {
"Name" : "type001",
"subType" : [ {
"Name": "subtype003",
"Counters": [
{
"name": "counter1",
"value": "0"
},{
"name": "counter5",
"value": "0"
},{
"name": "counter54",
"value": "0"
} ]
},{
"Name": "subtype001",
"Counters": [
{
"name": "counter002",
"value": "0"
},{
"name": "counter5",
"value": "0"
},{
"name": "counter65",
"value": "0"
}]
} ]
}, {
"Name" : "type002",
"subType" : [ {
"Name": "subtype006",
"Counters": [
{
"name": "counter1",
"value": "0"
},{
"name": "counter5",
"value": "0"
},{
"name": "counter54",
"value": "0"
} ]
},{
"Name": "subtype009",
"Counters": [
{
"name": "counter002",
"value": "0"
},{
"name": "counter5",
"value": "0"
},{
"name": "counter65",
"value": "0"
}]
} ]
} ]
}

 

Couldn't make any real breakthrough if not getting till here, some help really appreciated.

Thanks 

1 ACCEPTED SOLUTION

avatar
Expert Contributor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
2 REPLIES 2

avatar
Expert Contributor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
New Contributor

Hi Pvvk,

I really want to thank You!

Your Jolt is great.

I really need to work on my jolt skills and this helps me, have to exercise my reading of specs.

 

Thanks

Davide