Json encoder classes now throws UnexpectedValueException as XML classes
[Serializer] fixed CS
feature #9876 [Serializer] error handling inconsistencies fixed in the serializer decoders (fabpot)

This PR was merged into the 2.5-dev branch.

Discussion
----------

[Serializer] error handling inconsistencies fixed in the serializer decoders

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #9393
| License       | MIT
| Doc PR        | none

see #9586 for the original PR

Commits
-------

a1ab939 [Serializer] fixed CS
6d9f0be Json encoder classes now throws UnexpectedValueException as XML classes