Error xxxx not specified in JSON decoder properties

Am working on a POC where I have to invoke a Rest Api, collect the response and do futher processing on it. So to accept JSON data coming in response, I created a custom pipeline having JSON decoder at decode stage. After deploying the project and configuring it, dropped the test instance at receive location and watching for output in OUT folder(configured to archive API response).

As no output was generated - means some error was encountered, visited event log and found below error:






Root Node is not specified in property





Why this happened


It was my bad, missed to set couple of properties which are required by JSON decoder to convert JSON message in corresponding XML message i.e. Root Node Name and Namespace.



Root Node  and Namespace propertyin JSON decoder





Above error is in situation where you do not specify Root Node Name and Namespace both or if only Namespace is set.
Out of curiosity wanted to check what JSON decoder says if I set Root Node Name only and leave Namespace as Blank - It says, I want it to build XML message for you ;)
Namespace is not specified in property


What to do


When using JSON decoder it is mandatory to provide this two properties. It is because the Key is converted into element and Value as element value.

e.g.,

JSON Message:

{
   "company": "Maruti",
   "name": "Swift",
   "price": 800000
}

Corresponding XML:

   <company>Maruti</company>
   <name>Swift</name>
   <price>800000</price>



But a valid XML has a Root Node, thus that needs to be provided explicitly to JSON decoder to attach the converted XML structure under Root Node 



If you have questions or suggestions, feel free to do in comments section below !!!


Do share if you find this helpful .......
 
                          Knowledge Sharing is Caring !!!!!!


Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post