I'm trying to export the block content and it seems succesful, but once I call JSONSerialization, the json becomes invalid (the keys are no longer strings, ex. x in bounding box) See Json Snippet. My Code i sbelow:
let jsonText = try? editorViewController?.editor.export_(editorViewController?.editor.rootBlock, mimeType: IINKMimeType.JIIX)
I am not sure to understand your request. Indeed, our JIIX is basically a JSON string. In your case, you are basically getting a Dictionnary value, which is correct: https://developer.apple.com/swift/blog/?id=37
I am not sure to understand your request. Indeed, our JIIX is basically a JSON string. In your case, you are basically getting a Dictionnary value, which is correct: https://developer.apple.com/swift/blog/?id=37
Best regards,
Olivier
E
Ethan Chan
said
over 4 years ago
HI Olivier,
Thank you for your reply. I was just parsing it incorrectly.
Ethan Chan
I'm trying to export the block content and it seems succesful, but once I call JSONSerialization, the json becomes invalid (the keys are no longer strings, ex. x in bounding box) See Json Snippet. My Code i sbelow:
let jsonText = try? editorViewController?.editor.export_(editorViewController?.editor.rootBlock, mimeType: IINKMimeType.JIIX)
let data = jsonText!!.data(using: .utf8)!
let jsonDict = try? JSONSerialization.jsonObject(with: data, options : .allowFragments) as? [String:Any]
print(jsonDict)
Optional(Optional(["bounding-box": {
height = "126.22533";
width = "178.56972";
x = "9.236364399999999";
y = "13.854";
}, "id": RootBox, "type": Container, "children": <__NSArrayI 0x1c4223e00>(
{
"bounding-box" = {
height = "73.88800000000001";
width = "178.56972";
x = "9.236364399999999";
y = "13.854";
};
elements = (
{
"bounding-box" = {
height = "40.811081";
width = "45.840248";
x = "28.538353";
y = "27.723661";
Any Ideas? Thanks.
Dear Ethan,
I am not sure to understand your request. Indeed, our JIIX is basically a JSON string. In your case, you are basically getting a Dictionnary value, which is correct: https://developer.apple.com/swift/blog/?id=37
Best regards,
Olivier
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstOlivier @MyScript
Dear Ethan,
I am not sure to understand your request. Indeed, our JIIX is basically a JSON string. In your case, you are basically getting a Dictionnary value, which is correct: https://developer.apple.com/swift/blog/?id=37
Best regards,
Olivier
Ethan Chan
HI Olivier,
Thank you for your reply. I was just parsing it incorrectly.