Answer the question
In order to leave comments, you need to log in
How can I use a JavaScript object in c++?
Hello.
The question arose, how can I use a js object by casting it to json format if sent and used in a c ++ environment? Specifically, you need to read all the fields.
var msg = {
type: "chtoto",
text: "chtoto",
ident: 1,
};
Answer the question
In order to leave comments, you need to log in
Levingstone , If this is an arbitrary json, and not the nailed msg struct from the example, then the parsers will store some kind of tree where the vertices have key-names and links to data. The implementation of this tree is already as the parser decides. Take a ready-made library and see what it returns to you in the documentation.
If you want to parse this particular (msg) structure, then you may be able to turn json into a class in two strings and one int.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question