-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Hi team, I really need your help here as this will be live in 2 days.
I'm not able to achieve the nested loop feature and the code keeps failing, I'm fairly new to JUST.net, really looking for your help here.
My input JSON:
`{
"entityDataStore": {
"entityData": {
"entityParent": {
"NODE1": "dummy value",
"NODE2": "dummy value",
"NODE3": "dummy value",
"NODE4": "dummy value",
"entityParent-entityChild": [
{
"Id1": "dummy value",
"name": "dummy value",
"entity": "dummy value",
"ParentName": "dummy value"
},
{
"Id1": "dummy value",
"name": "dummy value",
"entity": "dummy value",
"ParentName": "dummy value"
}
]
}
}
}
}`
output, what I'm trying to achieve, is as the "entityParent-entityChild" has array of OBJECTS, so its dynamic in nature, I'm looking to recreate it as below:
Output JSON:
`{
"newChanges": [
{
"dataMember": "entityParent-entityChild",
"rows": [
{
"state": "New",
"rowid": "1",
"fields": [
{
"columnName": "name",
"originalValue": null,
"currentValue": "dummy value"
},
{
"columnName": "entity",
"originalValue": null,
"currentValue": "dummy value"
}
]
},
{
"state": "New",
"rowid": "2",
"fields": [
{
"columnName": "name",
"originalValue": null,
"currentValue": "dummy value"
},
{
"columnName": "entity",
"originalValue": null,
"currentValue": "dummy value"
}
]
}
]
}
]
}`
My Transformation: (Currently I have written to fetch a column only to see, if it will work or not, sadly i get an error 'Unexpected character encountered while parsing path'
`{
"entityDataStore": {
"#loop($.entityDataStore.entityData.entityParent, rows)": {
"fields": {
"#loop($.entityParent-entityChild)": {
"entity": "#currentvalueatpath($.entity)"
}
}
}
}
}
`
My C# code:
`
string input = jsonResponse;
string createTransformation= File.ReadAllText("<file.JSON>");
string transformedString = JsonTransformer.Transform(createTransformation, input);
`
Metadata
Metadata
Assignees
Labels
No labels