Extra curly braces when parsing string with Newtonsoft.Json.Linq.JObject









up vote
1
down vote

favorite












I have the following string that I want to parse:



result = ""faceId":"55717de7-4099-4016-8d72-5c4c9c06fca1","faceRectangle":"top":316,"left":327,"width":154,"height":154,"faceAttributes":"smile":0.013,"gender":"female","age":23.0,"facialHair":"moustache":0.0,"beard":0.0,"sideburns":0.0,"glasses":"Sunglasses""

JObject jsonObject = JObject.parse(result);


This is what the jsonObject becomes:




"faceId": "a2e0c348-c144-4cb7-a7c5-535efabc0482",
"faceRectangle":
"top": 316,
"left": 327,
"width": 154,
"height": 154
,
"faceAttributes":
"smile": 0.013,
"gender": "female",
"age": 23.0,
"facialHair":
"moustache": 0.0,
"beard": 0.0,
"sideburns": 0.0
,
"glasses": "Sunglasses"




As you can see above, I suddenly have extra curly braces around the object after parsing. When pasting this into http://json.parser.online.fr/ it returns errors because of these extra braces. Because of the braces, I can't query information from it.



Is there a way that I can get rid of the extra curly braces?










share|improve this question







New contributor




Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • "I suddenly have extra curly braces around the object after parsing" this makes no sense...where exactly are you seeing this display? When you parse JSON, it becomes an object - code variable representing a data structure. It ceases to be a string of text any more. Any textual representation you're seeing is probably just a function of the debugger, and is largely meaningless - if you want to see it as JSON again you must explicitly serialise it back into a string.
    – ADyson
    Nov 8 at 13:00










  • Now, you say "Because of the braces, I can't query information from it"...but you didn't show what code you're writing to query it, or which information exactly you want, or what error / issue you're facing in running your query. Some extra braces shown, probably in a debugger, would have no material impact on that as far as I can see. Please show the actual code which is causing the problem and explain what error you're getting. Then we might be able to offer some practical help. Thanks.
    – ADyson
    Nov 8 at 13:02






  • 1




    Are you looking at this value in the debugger? The Visual Studio debugger wraps the results of ToString() calls in curly braces for some reason. To see what value you really have you should output it to the debugger window using Debug.WriteLine, or write it to a file using File.WriteAllText. I bet you will find the extra curly braces suddenly aren't there anymore.
    – Brian Rogers
    Nov 8 at 14:58







  • 1




    By the way, here is a fiddle to prove the point: dotnetfiddle.net/p5sJEA
    – Brian Rogers
    Nov 8 at 15:20










  • Brian thank you, yes that is right! I got the value during debugging in Visual Studio. The problem is solved now!
    – Hampus Karl Sebastian Rude
    Nov 8 at 16:42














up vote
1
down vote

favorite












I have the following string that I want to parse:



result = ""faceId":"55717de7-4099-4016-8d72-5c4c9c06fca1","faceRectangle":"top":316,"left":327,"width":154,"height":154,"faceAttributes":"smile":0.013,"gender":"female","age":23.0,"facialHair":"moustache":0.0,"beard":0.0,"sideburns":0.0,"glasses":"Sunglasses""

JObject jsonObject = JObject.parse(result);


This is what the jsonObject becomes:




"faceId": "a2e0c348-c144-4cb7-a7c5-535efabc0482",
"faceRectangle":
"top": 316,
"left": 327,
"width": 154,
"height": 154
,
"faceAttributes":
"smile": 0.013,
"gender": "female",
"age": 23.0,
"facialHair":
"moustache": 0.0,
"beard": 0.0,
"sideburns": 0.0
,
"glasses": "Sunglasses"




As you can see above, I suddenly have extra curly braces around the object after parsing. When pasting this into http://json.parser.online.fr/ it returns errors because of these extra braces. Because of the braces, I can't query information from it.



Is there a way that I can get rid of the extra curly braces?










share|improve this question







New contributor




Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • "I suddenly have extra curly braces around the object after parsing" this makes no sense...where exactly are you seeing this display? When you parse JSON, it becomes an object - code variable representing a data structure. It ceases to be a string of text any more. Any textual representation you're seeing is probably just a function of the debugger, and is largely meaningless - if you want to see it as JSON again you must explicitly serialise it back into a string.
    – ADyson
    Nov 8 at 13:00










  • Now, you say "Because of the braces, I can't query information from it"...but you didn't show what code you're writing to query it, or which information exactly you want, or what error / issue you're facing in running your query. Some extra braces shown, probably in a debugger, would have no material impact on that as far as I can see. Please show the actual code which is causing the problem and explain what error you're getting. Then we might be able to offer some practical help. Thanks.
    – ADyson
    Nov 8 at 13:02






  • 1




    Are you looking at this value in the debugger? The Visual Studio debugger wraps the results of ToString() calls in curly braces for some reason. To see what value you really have you should output it to the debugger window using Debug.WriteLine, or write it to a file using File.WriteAllText. I bet you will find the extra curly braces suddenly aren't there anymore.
    – Brian Rogers
    Nov 8 at 14:58







  • 1




    By the way, here is a fiddle to prove the point: dotnetfiddle.net/p5sJEA
    – Brian Rogers
    Nov 8 at 15:20










  • Brian thank you, yes that is right! I got the value during debugging in Visual Studio. The problem is solved now!
    – Hampus Karl Sebastian Rude
    Nov 8 at 16:42












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have the following string that I want to parse:



result = ""faceId":"55717de7-4099-4016-8d72-5c4c9c06fca1","faceRectangle":"top":316,"left":327,"width":154,"height":154,"faceAttributes":"smile":0.013,"gender":"female","age":23.0,"facialHair":"moustache":0.0,"beard":0.0,"sideburns":0.0,"glasses":"Sunglasses""

JObject jsonObject = JObject.parse(result);


This is what the jsonObject becomes:




"faceId": "a2e0c348-c144-4cb7-a7c5-535efabc0482",
"faceRectangle":
"top": 316,
"left": 327,
"width": 154,
"height": 154
,
"faceAttributes":
"smile": 0.013,
"gender": "female",
"age": 23.0,
"facialHair":
"moustache": 0.0,
"beard": 0.0,
"sideburns": 0.0
,
"glasses": "Sunglasses"




As you can see above, I suddenly have extra curly braces around the object after parsing. When pasting this into http://json.parser.online.fr/ it returns errors because of these extra braces. Because of the braces, I can't query information from it.



Is there a way that I can get rid of the extra curly braces?










share|improve this question







New contributor




Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have the following string that I want to parse:



result = ""faceId":"55717de7-4099-4016-8d72-5c4c9c06fca1","faceRectangle":"top":316,"left":327,"width":154,"height":154,"faceAttributes":"smile":0.013,"gender":"female","age":23.0,"facialHair":"moustache":0.0,"beard":0.0,"sideburns":0.0,"glasses":"Sunglasses""

JObject jsonObject = JObject.parse(result);


This is what the jsonObject becomes:




"faceId": "a2e0c348-c144-4cb7-a7c5-535efabc0482",
"faceRectangle":
"top": 316,
"left": 327,
"width": 154,
"height": 154
,
"faceAttributes":
"smile": 0.013,
"gender": "female",
"age": 23.0,
"facialHair":
"moustache": 0.0,
"beard": 0.0,
"sideburns": 0.0
,
"glasses": "Sunglasses"




As you can see above, I suddenly have extra curly braces around the object after parsing. When pasting this into http://json.parser.online.fr/ it returns errors because of these extra braces. Because of the braces, I can't query information from it.



Is there a way that I can get rid of the extra curly braces?







json linq json.net






share|improve this question







New contributor




Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 8 at 12:43









Hampus Karl Sebastian Rude

61




61




New contributor




Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Hampus Karl Sebastian Rude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • "I suddenly have extra curly braces around the object after parsing" this makes no sense...where exactly are you seeing this display? When you parse JSON, it becomes an object - code variable representing a data structure. It ceases to be a string of text any more. Any textual representation you're seeing is probably just a function of the debugger, and is largely meaningless - if you want to see it as JSON again you must explicitly serialise it back into a string.
    – ADyson
    Nov 8 at 13:00










  • Now, you say "Because of the braces, I can't query information from it"...but you didn't show what code you're writing to query it, or which information exactly you want, or what error / issue you're facing in running your query. Some extra braces shown, probably in a debugger, would have no material impact on that as far as I can see. Please show the actual code which is causing the problem and explain what error you're getting. Then we might be able to offer some practical help. Thanks.
    – ADyson
    Nov 8 at 13:02






  • 1




    Are you looking at this value in the debugger? The Visual Studio debugger wraps the results of ToString() calls in curly braces for some reason. To see what value you really have you should output it to the debugger window using Debug.WriteLine, or write it to a file using File.WriteAllText. I bet you will find the extra curly braces suddenly aren't there anymore.
    – Brian Rogers
    Nov 8 at 14:58







  • 1




    By the way, here is a fiddle to prove the point: dotnetfiddle.net/p5sJEA
    – Brian Rogers
    Nov 8 at 15:20










  • Brian thank you, yes that is right! I got the value during debugging in Visual Studio. The problem is solved now!
    – Hampus Karl Sebastian Rude
    Nov 8 at 16:42
















  • "I suddenly have extra curly braces around the object after parsing" this makes no sense...where exactly are you seeing this display? When you parse JSON, it becomes an object - code variable representing a data structure. It ceases to be a string of text any more. Any textual representation you're seeing is probably just a function of the debugger, and is largely meaningless - if you want to see it as JSON again you must explicitly serialise it back into a string.
    – ADyson
    Nov 8 at 13:00










  • Now, you say "Because of the braces, I can't query information from it"...but you didn't show what code you're writing to query it, or which information exactly you want, or what error / issue you're facing in running your query. Some extra braces shown, probably in a debugger, would have no material impact on that as far as I can see. Please show the actual code which is causing the problem and explain what error you're getting. Then we might be able to offer some practical help. Thanks.
    – ADyson
    Nov 8 at 13:02






  • 1




    Are you looking at this value in the debugger? The Visual Studio debugger wraps the results of ToString() calls in curly braces for some reason. To see what value you really have you should output it to the debugger window using Debug.WriteLine, or write it to a file using File.WriteAllText. I bet you will find the extra curly braces suddenly aren't there anymore.
    – Brian Rogers
    Nov 8 at 14:58







  • 1




    By the way, here is a fiddle to prove the point: dotnetfiddle.net/p5sJEA
    – Brian Rogers
    Nov 8 at 15:20










  • Brian thank you, yes that is right! I got the value during debugging in Visual Studio. The problem is solved now!
    – Hampus Karl Sebastian Rude
    Nov 8 at 16:42















"I suddenly have extra curly braces around the object after parsing" this makes no sense...where exactly are you seeing this display? When you parse JSON, it becomes an object - code variable representing a data structure. It ceases to be a string of text any more. Any textual representation you're seeing is probably just a function of the debugger, and is largely meaningless - if you want to see it as JSON again you must explicitly serialise it back into a string.
– ADyson
Nov 8 at 13:00




"I suddenly have extra curly braces around the object after parsing" this makes no sense...where exactly are you seeing this display? When you parse JSON, it becomes an object - code variable representing a data structure. It ceases to be a string of text any more. Any textual representation you're seeing is probably just a function of the debugger, and is largely meaningless - if you want to see it as JSON again you must explicitly serialise it back into a string.
– ADyson
Nov 8 at 13:00












Now, you say "Because of the braces, I can't query information from it"...but you didn't show what code you're writing to query it, or which information exactly you want, or what error / issue you're facing in running your query. Some extra braces shown, probably in a debugger, would have no material impact on that as far as I can see. Please show the actual code which is causing the problem and explain what error you're getting. Then we might be able to offer some practical help. Thanks.
– ADyson
Nov 8 at 13:02




Now, you say "Because of the braces, I can't query information from it"...but you didn't show what code you're writing to query it, or which information exactly you want, or what error / issue you're facing in running your query. Some extra braces shown, probably in a debugger, would have no material impact on that as far as I can see. Please show the actual code which is causing the problem and explain what error you're getting. Then we might be able to offer some practical help. Thanks.
– ADyson
Nov 8 at 13:02




1




1




Are you looking at this value in the debugger? The Visual Studio debugger wraps the results of ToString() calls in curly braces for some reason. To see what value you really have you should output it to the debugger window using Debug.WriteLine, or write it to a file using File.WriteAllText. I bet you will find the extra curly braces suddenly aren't there anymore.
– Brian Rogers
Nov 8 at 14:58





Are you looking at this value in the debugger? The Visual Studio debugger wraps the results of ToString() calls in curly braces for some reason. To see what value you really have you should output it to the debugger window using Debug.WriteLine, or write it to a file using File.WriteAllText. I bet you will find the extra curly braces suddenly aren't there anymore.
– Brian Rogers
Nov 8 at 14:58





1




1




By the way, here is a fiddle to prove the point: dotnetfiddle.net/p5sJEA
– Brian Rogers
Nov 8 at 15:20




By the way, here is a fiddle to prove the point: dotnetfiddle.net/p5sJEA
– Brian Rogers
Nov 8 at 15:20












Brian thank you, yes that is right! I got the value during debugging in Visual Studio. The problem is solved now!
– Hampus Karl Sebastian Rude
Nov 8 at 16:42




Brian thank you, yes that is right! I got the value during debugging in Visual Studio. The problem is solved now!
– Hampus Karl Sebastian Rude
Nov 8 at 16:42

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Hampus Karl Sebastian Rude is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208001%2fextra-curly-braces-when-parsing-string-with-newtonsoft-json-linq-jobject%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Hampus Karl Sebastian Rude is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Hampus Karl Sebastian Rude is a new contributor. Be nice, and check out our Code of Conduct.












Hampus Karl Sebastian Rude is a new contributor. Be nice, and check out our Code of Conduct.











Hampus Karl Sebastian Rude is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208001%2fextra-curly-braces-when-parsing-string-with-newtonsoft-json-linq-jobject%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế