Click here to Skip to main content
11,577,710 members (41,631 online)
Rate this: bad
Please Sign up or sign in to vote.
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 :

"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
"ZA_MAINS_SUPPLY":"3~ 400V 50Hz"

in REST console as well ??

Posted 3-Jun-13 19:59pm
Jameel Moideen at 4-Jun-13 2:23am
can you post the rest endpoint?
Jameel Moideen at 4-Jun-13 2:26am
also post the code for calling the rest service in console
amitt0488 at 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();
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)

  Print Answers RSS
0 DamithSL 180
1 Peter Leow 180
2 Richard MacCutchan 125
3 Abhinav S 125
4 OriginalGriff 115
0 OriginalGriff 820
1 Sergey Alexandrovich Kryukov 681
2 Abhinav S 528
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 375

Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 4 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100