Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to deserealize JSON string #402

Closed
smilesrg opened this issue Feb 21, 2015 · 1 comment
Closed

Failing to deserealize JSON string #402

smilesrg opened this issue Feb 21, 2015 · 1 comment

Comments

@smilesrg
Copy link

I't trying to deserialize JSON string {"name":"Fabien"} with

        $result = $serializer->deserialize(
            '{"name":"Fabien"}',
            'ApheleiaExerciseBundle:TodoList',
            'json'
        );

but getting an error:

[2015-02-21 10:35:11] request.CRITICAL: Uncaught PHP Exception JMS\Parser\SyntaxErrorException: "Expected end of input, but got ":" of type T_NONE at position 22 (0-based)." at D:\Development\Projects\SymfonyExercise\vendor\jms\parser-lib\src\JMS\Parser\AbstractParser.php line 118 {"exception":"[object] (JMS\\Parser\\SyntaxErrorException(code: 0): Expected end of input, but got \":\" of type T_NONE at position 22 (0-based). at D:\\Development\\Projects\\SymfonyExercise\\vendor\\jms\\parser-lib\\src\\JMS\\Parser\\AbstractParser.php:118)"} []
@smilesrg
Copy link
Author

The problem was not in JSON but in class name shortcut. Full namespace without forward slash should be used: Apheleia\ExerciseBundle\Entity\TodoList instead of ApheleiaExerciseBundle:TodoList

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant