Is there any way that I can copy JSON value and insert into dynamics nav table,
Here is the sample JSON response. I am doing this in Dynamics NAV 2013. Initially I copied values using SELECTSTR but is there any proper way to do this.
"city": "New York",
You need to get the add-in Newtonsoft.Json from the NAV 2016 version too and copy in the add-in folder of the NAV 2013 version.
These are the objects.
And here there is a link to a zip file with the objects in NAV 2013, a report using the JSON data you posted, a file with the jason data and the add-in in the Json folder.
Thank you so much for you effort. It is really worth. After all I got following error. Do you know where I missed. ?
Microsoft Dynamics NAV
This message is for C/AL programmers: Cannot create an instance of the following .NET Framework object: assembly Newtonsoft.Json, Version=126.96.36.199, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, type Newtonsoft.Json.JsonConvert.
Did you copy the Json fiolder in the zip file inside the Add-ins folder of the service ?
You should duplicate the previous functions, change the names and parameters and then call the function GenerateStructureFromText with the Text var where is the JSON data.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I have done as your code. But When I pass the request, I am getting this error. Could you please guide me where I wrong .
Microsoft Dynamics NAV
A call to Newtonsoft.Json.JsonConvert.DeserializeXmlNode failed with this message: JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifing a DeserializeRootElementName. Path 'message', line 1, position 15538.
Looks like the problem is with the Json text.
Could you post how are you filling the text variable with the json data and the real json data ?
I just call the rest web-service and call the relevant function,then I will get the response, Same response I will pass into GenerateStructureFromText
Request := RequestClass.XMLHTTPRequestClass;
IF Request.status = 200 THEN BEGIN
I use message to check the response text. I am getting the data.
The problem is that your Json data don't have a root item
Maybe the best way is to wrap the Request.responseText with a root Item, something like this:
The right call is this one:
You need to remove the second curly brace.
It's really working for me. Thanks a lot!