โ05-25-2022 06:00 AM
I am trying to parse the below JSON in the JSON generator snap but getting the error.
Error: Expecting array for JSON-Path array index, found: Map
Payload :
[
{
โAccountIdโ: โ9999โ,
โFeatureNameโ: "test json -->>"$[0].UserIds[0]" test end "
}
]
Itโs simple but still not getting throughโฆ
โ05-25-2022 06:18 AM
Hi @vaidyarm,
You can do it with Apache Velocity.
[
{
#set( $a = "test json -->>" + $UserIds[0] + " test end ")
"AccountId": "9999",
"FeatureName": $a
}
]
Output:
Regards,
Viktor
โ05-25-2022 06:31 AM
Hey @viktor_n ,
Actually, the problem is that โ$[0].UserIds[0]โ is not the value that I am trying to get from the pipeline, but itโs the text itself that is supposed to have $ signed value in it.
(its the Mysql query which allows querying JSON data by SQL itself)
https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html
Text i want to parse : select testfield->>โ$[0].exploreUserIds[0]โ as testfield from sampletable
Json through which i am trying to parse :
[
{
"AccountId": "9999",
"FeatureName": "select somefield->>'$[0].UserIds[0]' as testfield from sampletable"
}
]
โ05-26-2022 12:49 AM
is $ sign cant be used in JSON generator?
โ05-26-2022 02:41 AM
Why you donโt just make this in Mapper?