NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1109 most downloaded on Packagist
Map nested JSON structures onto PHP classes
Latest stable
3.1.7
Last release 1 years ago
06 Nov 2025
Release timing varies
gaps range from 3 weeks to 11 months
Some releases are documented
notes for 23 of 46 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
46 releases · first in 2014
Drag across the ruler to compare, or tap a release to open it.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
additional-properties: ignore exception when additional properties' method is missing
additional-properties: adds support for typed additional properties
applies isEnabled condition to parse_ini_file function call
ini-parsing: added support for open_basedir restrictions
runtime-exception: convert JsonMapperException into RuntimeException
oaf-discriminators: support discriminators for oneof/anyof
language version upgrade: upgrade PHP language version to 8.2
security-enhancement: setup dependency review and release approvals
This release fixes a bug where jsonmapper is unable to deserialize the json to a Child class when the Parent class exists in a different namespace.
This release fixes a bug where jsonmapper is unable to deserialize the json to a Child class when the Parent class exists in a different namespace.
This release brings the following improvement in oneof/anyof features:
This release brings the following improvement in oneof/anyof features:
Now JsonMapper also support checking for a type of any given value in the provided type group, with jsonMapper's method checkTypeGroupFor. Following code sample demonstrate how one can check the type of any value.
$mapper = new JsonMapper();
$value = new Car();
$value = $mapper->checkTypeGroupFor('oneof(Car,Atom)', $value);
Here checkTypeGroupFor will throw a JsonMapperException if value's type didn't exist in the provided type group.
With this release, we have added following:
With this release, we have added following:
This release includes a bug fix that may arise while initialization of JsonMapper, if php.ini file is not loaded
This release includes a bug fix that may arise while initialization of JsonMapper, if php.ini file is not loaded
Throw a JsonMapperException if PHP configuration discards comments, by some setting in the configuration file or locally.
This release brings support for mapping oneOf or anyOf between two or more types onto any given value in JsonMapper, it includes following changes:
This release brings support for mapping oneOf or anyOf between two or more types onto any given value in JsonMapper, it includes following changes:
@mapsBy annotation for setters that describes the types that should map the value given for the field name described in @maps annotation.@factory annotation for setters can now hold the return Type for deserialization method, along with its path.mapFor() which provides mapping for any value by the provided types. It takes value as first argument while the types as second argument.Types must be provided in a specific string format, in both @mapsBy and mapFor(). Let A, B are any two types, then:
string, int, Model, float[] or they may also represent a combination of types like, anyOf string and int i.e. anyOf(string,int), or oneOf Car and map of float i.e. oneOf(Car,array<string,float>) etc.Following code snippet explain how to use this feature:
$mapper = new JsonMapper();
$contactOrStringObject = $mapper->mapFor($value, 'oneOf(string,Contact)');
This is how JsonMapper ensures that no other types can be mapped on the provided value but only string or Contact, if value is not one of the given types then mapFor() will throw JsonMapperException.
This release fixes a minor bug in the library which caused warnings when used in exactly PHP 8.0.0 runtime.
This release fixes a minor bug in the library which caused warnings when used in exactly PHP 8.0.0 runtime.
Thanks for @mr-feek for submitting PR #9.
This release fixes errors and warnings reported by PHP when JsonMapper was used with PHP >= 8.0.
This release fixes errors and warnings reported by PHP when JsonMapper was used with PHP >= 8.0.
This release does not add support for new language features introduced in PHP 8. That should be addressed in a later release.
Thanks to @bakerkretzmar and @Dry7 for the PRs #7 and #6.
When mapping a field of array type, the PHP 7 type is too generic. The JsonMapper should have inspected the @param annotation in the Docblock comment
When mapping a field of array type, the PHP 7 type is too generic. The JsonMapper should have inspected the @param annotation in the Docblock comment for a hint on what the element type for the array is and used this information to map the array of complex types correctly. However, this was not happening in the case of an array OR nullable type i.e ?array PHP type-hint. Instead, an array of stdClass was being created for an array of complex types.
This release fixes this issue. Just update your JsonMapper version to receive the fix.
Adds support for mapping to classes that have non-default constructors. Arguments are passed to the ctor based on the parameter name and type and matc
@map and @factory annotations to setter methods. Previously, only class fields were supported with these annotations.Since this release changes the mapping behavior for classes that have non-default constructors, we are bumping up by a major version number.
This release fixes warnings reported by PHP when JsonMapper was used with PHP >= 7.0. Other changes include:
This release fixes warnings reported by PHP when JsonMapper was used with PHP >= 7.0. Other changes include:
Factory Method annotation allows you to specify a method which will be used to initialize a property on the object. This annotation can be applied per
Factory Method annotation allows you to specify a method which will be used to initialize a property on the object. This annotation can be applied per property.
Nothing published for this version
Added supported for polymorphic mappings using a discriminator tag.
Added supported for polymorphic mappings using a discriminator tag.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.