I am trying to use sscanf to extract specific values of name and msg from a string {"username":"ece","says":"hello"} as following:
sscanf(data, "{"\username"\:"\%s"\,"\says"\:"\%s"\}", name, msg);
I need ‘ece’ in name and ‘hello’ in msg but I am getting ece”,”says”:”hello” in name and msg remains empty.
The
%sformat stops at the next white space. You need it to stop earlier, at the'"', so you need to use a character set,