Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a created a webService, whose output string (in JSON) is given below :

"[{\"CALC_ALTITUDE\":213,\u000a\"ZA_MAINS_SUPPLY\":\"3~ 400V 50Hz\"}]"

When i set this string in a TextBox, the output comes like this :

[{
"CALC_ALTITUDE":213,
"ZA_MAINS_SUPPLY":"3~ 400V 50Hz"
}]


And this is a proper JSON text.

But, when i access this using REST Console, the output appears like :

"[{\"CALC_ALTITUDE\":213,\u000a\"ZA_MAINS_SUPPLY\":\"3~ 400V 50Hz\"}]"

My problem is that, TextBox is interpreting this text very well, by reading newline characters and escape sequence \". But, REST Console is not able to do so.

Any idea how to show this text in the same way as this
[{
"CALC_ALTITUDE":213,
"ZA_MAINS_SUPPLY":"3~ 400V 50Hz"
}]


in REST console as well ??

Thanks
Posted
Comments
Jameel VM 4-Jun-13 2:23am    
can you post the rest endpoint?
Jameel VM 4-Jun-13 2:26am    
also post the code for calling the rest service in console
amitt0488 4-Jun-13 2:54am    
[DllImport("FANselect.dll", CallingConvention = CallingConvention.StdCall,
EntryPoint = "ZAJsonRequestA", ExactSpelling = false)]
private static extern IntPtr ZAJsonRequestA([MarshalAs(UnmanagedType.LPStr)]StringBuilder szReq);

public string getZAJsonRequestA(string input)
{
StringBuilder sbuilder = new StringBuilder();
sbuilder.Append(input);
var variable = ZAJsonRequestA(sbuilder);
string sResult = Marshal.PtrToStringAnsi(variable);
string op = sResult.Trim();

return op;
}

Here the output is coming from a DLL and getZAJsonRequestA(input) is called using a url which interacts with the DLL & gives the output in string form.

This output is shown in REST Console.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900