Hello all,
I have external assembley that has Json ustring data. I have to pass value between Json .NET type and C/AL type?
Are below converts are same?
1. Json .NET into C/AL
C/AL into Json .NET
2. std::string into std::wstring
std::wstring into std::string
How can I pass value between Json and C/AL?
Regards,
Undy
0
Answers
It gives a couple of examples on how to use JSON in NAV.
mibuso.com/downloads/nav-techdays-2015-connecting-to-the-outside-world-how-to-get-the-best-out-of-web-services-movie
Or check out Kaufmans blog about this:
kauffmann.nl/index.php/2015/11/26/nav-techdays-2015-the-web-service-examples/
Have you checked the cables?
Have you released the filters?
http://www.navfreak.com
Do you want to deserialize a JSON string to an object in C/AL? If so, you would have to create .NET classes and use those to serialize/deserialize. Then you can use those objects to transfer data to NAV objects.
I have external assembley and it has JSON type functions. I have to get values into this functions and return some values from these functions.
Assembley.Put(amount,name) :=value from NAV
Assembley.Send(id, No) <-return values from API service
I dont any experience with .NET especially JSON so How can I use serialize/deserialize?
Regards,
Undy
Which is basically just another notation. You can simple deserialize in NAV using the Newtonsoft.Json assembly that comes included with NAV.
Your advise is helpful to me so much. This example is Json string->.NET assembley. But I have to put values to Json string from NAV string. NAV string ->Json .NET assembley
Can I use JSonConvert.SerializeObject?
Regards,
Undy
put(ustring)
{"amount": String, "vat": String, "cashAmount": String, "nonCashAmount": String,
"stocks": [{ "code": String, "name": String,"measureUnit": String, "qty": String,}],
I want to pass value into this put() function from C/AL (vat entries).
I tried on below example:
MyString:='123.45';
BridgePos:=BridgePos.Class1;
Type:=BridgePos.GetType();
JsonSerializerSettings:=JsonSerializerSettings.JsonSerializerSettings();
Result:=JsonConvert.SerializeObject(MyJsonString,Type,JsonSerializerSettings);
MESSAGE('BridgePos result %1',BridgePos.put(Result));
But it appears wrong type data and cant pass value
Regards,
Undy
My class would look like this:
First loop all the stock entries you need, creating new instances of a Stock class and add them to a generic list (System.Collections.Generic.List`1.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') one by one.
When you're done looping, instantiate an object of your VATEntry class, with the list of 'Stocks'.
It helps me alot.
There is one issue left. How to instantiate an object of VATEntry class, with list of Stocks?
Best Regards,
Undy
I`ve been waiting for your reply for this help
Regards,
Undy
I need your help on these where you able to finish the project as I have similar thing and I would want to know how you were able to work it out.