You are not logged in.
Pages: 1
I receive some Json data from webserver , but the contents were encoded into Utf8,
"title":"\u5317\u4eac\u706b\u8f66\u7ad9\u552e\u7968\u5458\u8d2a\u6c61140\u4f59\u4e07\u9000\u7968\u6b3e \u5224\u521110\u5e74",
can I decode it?
Thank you for help
Offline
Thank you for reply, but the problem is I can not find the document how to decode by using mORMot .
Offline
The easiest is to use SynCommons.pas, then a TDocVariant:
var doc: variant;
begin
doc := _JsonFast('{"title":"\u5317\u4eac\u706b\u8f66\u7ad9\u552e\u7968\u5458\u8d2a\u6c61140\u4f59\u4e07\u9000\u7968\u6b3e \u5224\u521110\u5e74"}');
writeln(doc.title);
end;
Ensure you convert the JSON as expected into our RawUTF8 string, using e.g.
begin
doc := _JsonFast(StringToUTF8(aStringContainingJson));
...
Offline
If you're just trying to work out what the data is, I think https://json-csv.com decodes UTF8, then you can at least view the data there.
Offline
Pages: 1