.net - How To Parse JSON Object Using Regular Expression in C# -



.net - How To Parse JSON Object Using Regular Expression in C# -

this question has reply here:

regex extract object json string 3 answers string sample = "{\"stack_size\":4,\"thes_stack\":[4,4]}";

how can parse using re in c#?

first of isn't valid json, remove backslashes. second, using library json.net can parse sample.

string sample = "{"stack_size":4, "thes_stack":[4,4]}"; var parsed = jsonconvert.deserializeobject<dynamic>(sample);

that parse dynamic type, if want more typed create own class:

class stackinfo { public int stack_size {get; set;} public int[] thes_stack {get; set;} }

then can deserialize it:

string sample = "{"stack_size":4, "thes_stack":[4,4]}"; var parsed = jsonconvert.deserializeobject<stackinfo>(sample);

but since didn't set need or problem suggestions in comments no 1 can help you.

c# .net regex json

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -