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
1 answer

JSMSerialier ignoring some properties

I'm trying to deserialize a json string to an entity to be used with doctrine. For some reason some of my properties are being ignored. AppBundle\Entity\BoardSong.php
matt
  • 320
  • 4
  • 15
0
votes
1 answer

JMS\Serializer\Exception\RuntimeException: Resources are not supported in serialized data. Path: Monolog\Handler\StreamHandler -> etc

I'm working with Symfony 4 and i have installed JMS serializer with FOSRest bundle. So every time i've got an error i've got this message : JMS\Serializer\Exception\RuntimeException: Resources are not supported in serialized data. Path:…
psylo66
  • 608
  • 11
  • 26
0
votes
2 answers

Jms Serializer don't call constructor

I'm using Symfony 2.8 with JMS Serializer and when i use deserializer method the constructor of my entity class is not called. See my code: my service.yml jms_serializer.unserialize_object_constructor: class:…
0
votes
1 answer

Serialized value within a group jms symfony

How can I serialize only a field within a JMS group in symfony? return $this->json($products, Response::HTTP_CREATED, [], ['groups' => ['user']]); So I want to be serialized only the user id, not all the user details. Any ideas? EDIT: The…
IleNea
  • 569
  • 4
  • 17
0
votes
1 answer

JMS Serializer Event Subscriber Filters Out Proxy Classes

I have an entity Acme\Bundle\Entity\Author which has a one to many relationship to Acme\Bundle\Entity\Article and I have two JMS serializer event subscribers for both entities. Subscriber for…
ssrp
  • 1,126
  • 5
  • 17
  • 35
0
votes
1 answer

Valuable? Fields support in REST API

I've read some topics about GraphQL, and one of the great features I like is you can specify fields you want (Client End). I'm thinking maybe I can also add it into REST API. I look around and find there has already such specification:…
Yarco
  • 763
  • 9
  • 18
0
votes
1 answer

Fields inclusion rules in JMS Serializer

I'm looking for a way to dynamic include fields when output JSON data through JMS serializer. And I found the post here: https://jolicode.com/blog/how-to-implement-your-own-fields-inclusion-rules-with-jms-serializer The solution here is for…
Yarco
  • 763
  • 9
  • 18
0
votes
0 answers

How to serialize empty string to selfclosing tag

Using JMS Serializer I need to get self closing tag setting empty string I always get I can't use ->setSerializeNull(true) because the class I'm serializing has many properties that if they are null they can't be…
mysiar
  • 430
  • 1
  • 5
  • 14
0
votes
1 answer

JMS Serializer ignoring exclusion policy with accessor annotation?

So I have a response class like this (simplified snippet): /** * @Serializer\ExclusionPolicy("all") */ class MyResponse { /** * @Serializer\Expose * @Serializer\Groups({"myGroup"}) * @Serializer\Accessor("getMyName") */ …
Chris
  • 58
  • 6
0
votes
1 answer

JMS serializer serialize custom object and deserialize

I'm most probably confused with visitors mechanism in JMS. But I want achieve this: serialize class to json and back with adding custom property class which indicates to what class deserialization should be made. public static function…
zajca
  • 2,288
  • 4
  • 30
  • 40
0
votes
2 answers

How to search for a String inside a textfile Using Apache Camel

I am new to Apache camel. Does anyone know how to use camel to process the content of a text file to check if a particular string e.g "error" is present within a text file. I cant seem to go past the first line below with java. Any help will be…
Beanieman
  • 7
  • 3
0
votes
0 answers

JMS serializer multi-demension array to single array

Following query is run by doctrine SELECT o, (SELECT count(f.id) FROM AppBundle:Feedback f WHERE f.order = o.id) isFeedbackAdded FROM AppBundle:Order o WHERE o.provider = :provider Result generated by JMS "_embedded": { "items": [ { …
Basit
  • 16,316
  • 31
  • 93
  • 154
0
votes
1 answer

how to visit each Entity's property when `serializer.pre_serialize` event is raised

I would like to visit recursively each property of the serializing Entity, check if a string is set and verify that the metadata property is properly set to string, otherwise change it in order to allow the serialization. Imagine a users property…
Bertuz
  • 2,390
  • 3
  • 25
  • 50
0
votes
2 answers

How deserialize from array ids in jms?

I can not figure out how to deserialize a object from a array of IDs? Here is a simple example my array. "roles":["1","2","3"] But when trying I get the error that object expected-class AppBundle\Entity\Role... is There something for this? Thank…
Seintero
  • 23
  • 5
0
votes
2 answers

JMS Serializer Bundle: Deserialize XML to Nested Objects

I need to deserialize the following XML into an object graph: true 1 foo
Alexey Kosov
  • 3,010
  • 2
  • 23
  • 32