Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
c# JsonConvert SerializeObject fails
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Permudious" data-source="post: 481526" data-attributes="member: 55273"><p>Good evening,</p><p></p><p>I am developing a Web API for the first time, where I should like expect a JSON output.</p><p>Whatever I try with a return I still have an invalid response.</p><p></p><p>This is the output:</p><p>"[{\"TemperatureAquarium\":\"27.0\",\"TemperatureAquariumShrt\":\"27\",\"TemperatureSump\":\"26.7\",\"TemperatureSumpShrt\":\"26\"}]"</p><p></p><p>But in my opinion it should be;</p><p>[{"TemperatureAquarium":"27.0","TemperatureAquariumShrt":"27","TemperatureSump":"26.7","TemperatureSumpShrt":"26" }]</p><p></p><p>I already tried things like replace(@"\","") or replace("\\", string.empty) for removing the backslashes, but they still got there.</p><p>Even when I add the option Formatting.Intended it goes wrong.</p><p></p><p>the return code is; return JsonConvert.SerializeObject(TemperatureList);</p><p></p><p>What do I wrong?</p></blockquote><p></p>
[QUOTE="Permudious, post: 481526, member: 55273"] Good evening, I am developing a Web API for the first time, where I should like expect a JSON output. Whatever I try with a return I still have an invalid response. This is the output: "[{\"TemperatureAquarium\":\"27.0\",\"TemperatureAquariumShrt\":\"27\",\"TemperatureSump\":\"26.7\",\"TemperatureSumpShrt\":\"26\"}]" But in my opinion it should be; [{"TemperatureAquarium":"27.0","TemperatureAquariumShrt":"27","TemperatureSump":"26.7","TemperatureSumpShrt":"26" }] I already tried things like replace(@"\","") or replace("\\", string.empty) for removing the backslashes, but they still got there. Even when I add the option Formatting.Intended it goes wrong. the return code is; return JsonConvert.SerializeObject(TemperatureList); What do I wrong? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
c# JsonConvert SerializeObject fails
Top