Is there an assembly or service that Epicor has that has Json helpers that you could use to select the output as Json instead of a string? I have no idea, just something I thought of.
Playing around with it a bit, I think I understand what it’s doing. It’s returning a json object with the return parameter(s) and then the result as a string.
You have to provide some real type to return. In the ideal scenario you could define a response parameter as an object. Because you used a string, and serialized an anonymous object to a string, the response will be shown as such. The response is serialized twice.
I just work around the limitation by deserializing twice where you consume it.
We have an external system that currently makes multiple API calls and gets JSON payload responses. My suggestion to make it more upgrade friendly is to create a function and return the information from the single function call.
I don’t know the limitations of the other system (yet), so I was just visually comparing the differences and was trying to figure out why it was different.
I wish (Idea time?) Epicor would have an option for some kind of JSON payload response rather than just assigning it to a string.
You can also with the appropriate references, return a few other objects that are direct json.
It might take a little digging, but there might be one that fits closer if it’s that important to you.
An epicor function in its own returns a JSON payload so if you just set the output variable of your function to result : boolean then the response wil look like
Gah, so close. I wish I could use a DataTable instead of a DataSet. Any idea if there’s a way to add a DLL to the Assemblies so I could use something custom or a generic DataTable?