Deserialize JSON Array to PageList with JSON Data Transform
So I have problem parsing JSON arrays which do not have named properties
I have a class Token
I have property PageList "tokens" of class Token on my Class XYZ
On my Class XYZ I have defined a JSON data transform to convert below JSON into "tokens" PageList
[ { "token1" : "value1" }, { "token2" : "value2" } ]
Token class has two properties "token" and value". The reason I have to do this is "token1" and "token2" are not fixed named property like "token" in which case I would have only 1 property in my Token class. I am forced to have two properties so I can extract raw data on the lhs and rhs
For life of me I cannot figure out how to do the mapping.
I specified Top Element Structure as an "Array" because top level object is an array and not object
Then I selected "Primary.tokens" for PageList property. It gives me error below
Cannot reference another top-level page: Primary.errors Invalid property reference |
Needless to say I selected "Objects" for "Elements of this JSON are"
Since I cannot get past above basic errors I am not able to try anything else. Like, figuring out how to specify the JSON on the RHS when doing manual mapping because "token1" and "token2" are not fixed.
I am starting to think maybe I need to massage the JSON or maybe not use JSON data transform. Would really appreciate any pointers.
So I have problem parsing JSON arrays which do not have named properties
I have a class Token
I have property PageList "tokens" of class Token on my Class XYZ
On my Class XYZ I have defined a JSON data transform to convert below JSON into "tokens" PageList
[ { "token1" : "value1" }, { "token2" : "value2" } ]
Token class has two properties "token" and value". The reason I have to do this is "token1" and "token2" are not fixed named property like "token" in which case I would have only 1 property in my Token class. I am forced to have two properties so I can extract raw data on the lhs and rhs
For life of me I cannot figure out how to do the mapping.
I specified Top Element Structure as an "Array" because top level object is an array and not object
Then I selected "Primary.tokens" for PageList property. It gives me error below
Cannot reference another top-level page: Primary.errors Invalid property reference |
Needless to say I selected "Objects" for "Elements of this JSON are"
Since I cannot get past above basic errors I am not able to try anything else. Like, figuring out how to specify the JSON on the RHS when doing manual mapping because "token1" and "token2" are not fixed.
I am starting to think maybe I need to massage the JSON or maybe not use JSON data transform. Would really appreciate any pointers.
***Edited by Moderator Marije to add Capability tags***