onryldz / x-superobject

Delphi Cross Platform Rapid JSON
316 stars 118 forks source link

Unexpected token ILLEGAL. (Line: 0 Col: 185) #84

Closed AlexMercier closed 8 years ago

AlexMercier commented 8 years ago

Error when try to create json from string.

var 
 obj:ISuperObject;
 ...
begin
   obj:= SO(myString);

My json content pasted here: http://pastebin.com/raw/DJEfYrCS

Error message:

---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class TJSONSyntaxError with message 'Unexpected token ILLEGAL. (Line: 1 Col: 1)'.
onryldz commented 8 years ago

Hi, This json is bad. Because a json string in cannot be use "#$D#$A" chars. Instead of "\r\n" should be use. As Sample :

{
    "likes": {
        "count": 0
    },
    "comments": {
        "count": 0
    },
    "reposts": {
        "count": 0
    },
    "owner_id": -97263880,
    "id": 8,
    "from_id": -97263880,
    "text": "Justica - Лига справедливости, герои вселенной DC для Телеграм!\r\n\r\nSome hero sticker pack today! This sticker pack contains Justice League stickers! Enjoy!\r\n\r\nhttps://telegram.me/addstickers/Ligadajustica #Telegram #stickers #стикеры",
    "date": 1436398400,
    "post_type": "post",
    "attachments": [{
        "type": "photo",
        "photo": {
            "photo_604": "http://cs622224.vk.me/v622224595/3936c/qePgLs1vfW4.jpg",
            "photo_130": "http://cs622224.vk.me/v622224595/3936b/0y72JnMQznw.jpg",
            "photo_75": "http://cs622224.vk.me/v622224595/3936a/8cL1Rb0jJSM.jpg",
            "access_key": "c6752cdeace5447c6f",
            "width": 590,
            "owner_id": -97263880,
            "album_id": -7,
            "id": 373244125,
            "height": 587,
            "text": "",
            "date": 1436398414,
            "user_id": 100
        }
    },
    {
        "type": "link",
        "link": {
            "url": "https://telegram.me/addstickers/Ligadajustica",
            "description": "",
            "title": "Add sticker set Justica on Telegram",
            "image_src": "http://cs627626.vk.me/v627626345/5f41/8QyNcQ0z1sU.jpg"
        }
    }]
}
AlexMercier commented 8 years ago

ok. thank you.

onryldz commented 8 years ago

you are welcome