hi all,
need help here
below is my XML data received from REST API integration . i want to read a particular attribute.
for example "Registration Date " in below.
thanks in advance
hi all,
need help here
below is my XML data received from REST API integration . i want to read a particular attribute.
for example "Registration Date " in below.
thanks in advance
Hi @armamidwar
Use read text file and pass the string variable
Use deserialize json activity
Use for each item in xml.linq.element(“strnode”)
Use add to dictionary
Thanks
Ashwin.S
Thanks for replying. got first two lines but o/p of desacralize json would be “jobject” then how to implement 3rd instruction
You got the the scenario that you have JSON data within XML. So pull out the JSON Content from the XML Part. Then deserialize this JSON and retrieve the values of interest
thanks Ashwin , was helpul didn’t solve my issues as my documents has both json and xl data and i tried to run you r code with my inputs for each loop failed
thanks ppr , for replying.
can you tell me how to programmatically remove json out of it or either of one
thanks
Give me some time but please copy the text from screenshot here as text, so I can use for cross checks. Thanks
<Vehicle xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://regcheck.org.uk">
<vehicleJson>{
"Description": "GENERAL MOTORS INDIA PVT LTD / CHEVROLET BEAT LT TCDI",
"RegistrationYear": "2012",
"CarMake": {
"CurrentTextValue": "GENERAL MOTORS INDIA PVT LTD"
},
"CarModel": {
"CurrentTextValue": "CHEVROLET BEAT LT TCDI"
},
"MakeDescription": {
"CurrentTextValue": "GENERAL MOTORS INDIA PVT LTD"
},
"ModelDescription": {
"CurrentTextValue": "CHEVROLET BEAT LT TCDI"
},
"VechileIdentificationNumber": "MA6BFBFNCCT00000",
"EngineNumber": "10AB5Z1215XXXXX",
"FuelType": {
"CurrentTextValue": "DIESEL"
},
"RegistrationDate": "31/08/2012",
"Owner": "CHRISTINA BENEDICT",
"Fitness": "30-Aug-2027",
"Insurance": "30-Aug-2019",
"Location": "RTO, K.R.PURAM",
"ImageUrl": "http://in.carregistrationapi.com/image.aspx/@R0VORVJBTCBNT1RPUlMgSU5ESUEgUFZUIExURCAvIENIRVZST0xFVCBCRUFUIExUIFRDREk="
}</vehicleJson>
<vehicleData>
<Description>GENERAL MOTORS INDIA PVT LTD / CHEVROLET BEAT LT TCDI</Description>
<RegistrationYear>2012</RegistrationYear>
<CarMake>
<CurrentTextValue>GENERAL MOTORS INDIA PVT LTD</CurrentTextValue>
</CarMake>
<CarModel>CHEVROLET BEAT LT TCDI</CarModel>
</vehicleData>
</Vehicle>
Here are the steps you need to do @armamidwar,
As you have entire element as XML and inside it you have JSON in the root element.
First
remember, the JSON is in the root element of XML and you will get it easily
Thanks Hareesh , quite understandable
for 2nd step i used - xdocument.elements(“Vehiclejson”).value.tostring
but it has thrown an error .
Thanks
Yeah, that I need to check . I will try it after sometime and get back to you.
But we have alternative to do that @armamidwar, use this
Check what will happen once you are removing the schema information from root element. Change it to < Vehicle > without spaces within the brackets and try again
thanks Hareesh it worked , but it didn’t give me the attribute value - for example owner name
I’m getting the value without any issue after getting the JSON ,
Yeah, that is to get the JSON inside the first element. Then you have to deserialize that JSON and same as above, you need to get the required value @armamidwar
Please find the screenshot above