Questions tagged [jms-serializer]

Serializer is a library, that allows you to (de-)serialize data of any complexity. It supports XML, JSON, and YAML.

Serializer is a library, that allows you to (de-)serialize data of any complexity. Currently, it supports XML, JSON, and YAML.

Website: http://jmsyst.com/libs/serializer

It also provides you with a rich tool-set to adapt the output to your specific needs.

Built-in features include:

  • (De-)serialize data of any complexity; circular references are handled gracefully.
  • Supports many built-in PHP types (such as dates)
  • Integrates with Doctrine ORM, et. al.
  • Supports versioning, e.g. for APIs
  • Configurable via PHP, XML, YAML, or Doctrine Annotations
222 questions
0
votes
0 answers

Cannot override final class FormErrorHandler with JWT Serializer

Good morning all , I did a complete migration of my symfony 2.8 application to version 5.4. I am now at the unit testing stage. but I have a little problem with one in running my tests. On the old version of my project, I was using the…
oracle972
  • 77
  • 10
0
votes
1 answer

Change Symfony serializer order when extending models

I am working on a REST API with Symfony 5.4; PHP 7.4; using the default Symfony serializer. When I define a model extending from another, the properties of the child model are serialized before the parent's properties; I would like to change that…
Diplodoco
  • 71
  • 1
  • 7
0
votes
1 answer

JMSSerializer > don't return null value and empty array

I want to serialize some object but don't return null values or empty array. Here is my json: { "success": true, "detail": { "id": 588, "label": null, "show_label": null, "type": null, "click_type": null, "child_site_module":…
MatDepInfo
  • 317
  • 3
  • 16
0
votes
0 answers

Try to update Sonata, have error with jms-serializer

I need to update my bundles for security reasons but when i try to do a composer update, i have a lot of problem with sonata. First, SonataCore, sonataMedia and JMS-serializer disappear. bundles.php If a tried to reinstall SonataCore with composer…
0
votes
1 answer

Using JMS Serializer with PHPSpec testing case causes The annotation @JMS\Serializer\Annotation\Type does not exist, or could not be auto-loaded

I have a function to transform array into object. public function transform(array $pickupPoints): array { return SerializerBuilder::create() ->setSerializationContextFactory(function () { return…
Karol Gasienica
  • 2,825
  • 24
  • 36
0
votes
2 answers

Deserialize single string property into object in symfony JMS PHP

Having PHP, Symfony 4.4, JMS Serializer and json payload (request body) as such: { "quantity": 1, "product": { "sku": "bla" }, "myId": { "id": "0010N00005GcOhhQAF" } } This payload is send to my endpoint and everything is…
0
votes
0 answers

JMS\Serializer OBJECT_TO_POPULATE

Is it possible deserialize to an object with JMS\Serializer? I don't see n option like the one Symfony Serializer has: https://symfony.com/doc/current/components/serializer.html#deserializing-in-an-existing-object $serializer->deserialize($data,…
Developer
  • 2,731
  • 2
  • 41
  • 71
0
votes
1 answer

How to serialize object as its own property (array) using JMS Serializer EventSubscriberInterface (php, symfony)

I need to serialize an object as its own property (it's type is array), I mean that the object has an array property books, and after transforming it I want to skip the books key, so the structure will be more flat [book1, book2] (not [books =>…
0
votes
1 answer

Strange Offset between De- and Serialization of Datetime with JMS Serializer

I'm developing a scheduling app whose frontend communicates with the backend via UNIX-Timestamp-based time fields. The app has been used for almost a year in production, but suddenly, thank god only on the test server, every save and reload of an…
S. Parton
  • 73
  • 1
  • 7
0
votes
2 answers

Symfony 5.2 Error: The directory "var/cache/dev/jms_serializer" does not exist

Symfony 5.2 with jms/serializer-bundle 3.7.0. After symfony cache cleaning by command cache:clear on the next request I get an error: The directory "var/cache/dev/jms_serializer" does not exist I noticed that for symfony 4.4 $dir variable has…
Artem
  • 1,426
  • 12
  • 17
0
votes
2 answers

Symfony5 JMS Serializer - model with calculated property without ORM annotation

I have model properties like this: /** * @ORM\Entity(repositoryClass=AssignmentRepository::class) */ class Assignment { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private ?int $id; …
goldlife
  • 1,949
  • 3
  • 29
  • 48
0
votes
1 answer

Default deserializeFormats for DateTime in JMS Serializer

I see default_format and default_timezone configs for deserializing datetime values but I don't see a config to specify a list of alternate formats. I would like for my API to accept timestamps with our without timezone (assuming UTC if not…
Paul Dugas
  • 325
  • 2
  • 14
0
votes
0 answers

JMSConnection serialization fail

Currently I'm building an application that reads messages (transactions in json) in a Kafka Topic and sends to IBM MQ at production. I'm having some trouble with serialization in the JMS classes and kinda lost on how to fix it. My code is: object…
Geo
  • 177
  • 6
0
votes
1 answer

symfony serializer jmsserializerbundle service name conflict

I have the following issue: I am working on a symfony (2.8) project which depends on the jmsserializerbundle (1.1). When enabling the symfony-serializer alongside the jms-serializer package, # app/config/config.yml framework: # ... …
user10695266
0
votes
2 answers

How configure JMSSerializer in Symfony to serialize custom class to/from int?

I am working on a Symfony 3.4 based web app project which uses JMSSerializer to serialize different custom classes to JSON to send this data to mobile apps. How can I serialize/deserialize a custom class to/from to int? Assume we have the following…
Andrei Herford
  • 17,570
  • 19
  • 91
  • 225