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
2 answers

Complex serialization

For example, I have two entities: main (parent) entity (for example User) and dependent entity (Post). I want to serialize User entity using JMS Serializer with additional information of its first post date. The post date stored in DB is timestamp…
Aliance
  • 847
  • 1
  • 11
  • 23
0
votes
1 answer

how to consider annotation groups in a ObjectConstructor

JMSSerializer comes with a Doctrine Object Constructor that does its job, but imagine an Entity with two properties forming a primary key: UserBase prop annotated with @ORM\Id and @Serializer\Groups({"1"}) - username prop annotated with…
Bertuz
  • 2,390
  • 3
  • 25
  • 50
0
votes
0 answers

Symfony2/FOSRestbundle ignoring serialization groups (for array of results)

Serialization groups work for me fine when i fetch one entity but when i try fetch array of results i got empty result set. I do this like that: * @\FOS\RestBundle\Controller\Annotations\View(serializerGroups={"client"}) but also tried manually…
0
votes
1 answer

Deserialise XML with JMS Serializer, getting empty opbject

I'm trying to deserialise the following XML: ..
..
.. ..
Tom
  • 1,547
  • 7
  • 27
  • 50
0
votes
1 answer

JMSSerializer: Deserializing empty DateTime XML element into PHP "null" object

I'm working on the deserialization of a XML file. It's possible that some elements won't contain any data so I'm trying to deserialize the following XML element (OfferDate) into a null object instead of a \DateTime object:
0
votes
1 answer

jmsserialize does not deserialize OneToOne entity the right way

I have two entities: User and UserInfo: class User { ... /** * @ORM\OneToOne(targetEntity="UserInfo") * @ORM\JoinColumn(name="userinfo_id", referencedColumnName="id_user") * @Serializer\Groups({"o", "i-self-editUser"}) …
Bertuz
  • 2,390
  • 3
  • 25
  • 50
0
votes
0 answers

Fos Rest View response

I use "name": "friendsofsymfony/rest-bundle", "version": "1.7.7", "name": "jms/serializer-bundle", "version": "0.13.0" When my response contains a word in Cyrilic, I the response like this: return…
shuba.ivan
  • 3,824
  • 8
  • 49
  • 121
0
votes
1 answer

Could not decode JSON, malformed UTF-8 characters (incorrectly encoded?) - unexpected PHP beahviour

Deserialization of REST request via JMS Serializer was terminated with exception "Could not decode JSON, malformed UTF-8 characters (incorrectly encoded?)". This exception is raised when PHP function json_las_error returns JSON_ERROR_UTF8 value. I…
0
votes
0 answers

Register custom jmsserializer handler

I need a custom JMSSerializer handler which handles forms differently and therefore created a class AppBundle\FormJmsSerializerHandler: class FormJmsSerializerHandler implements SubscribingHandlerInterface { public static function…
0
votes
0 answers

Symfony, JMS serialization bundle, define a strategy on deep oneToMany relation

I use JSM serialization bundle, which is fine, in symfony 2. The deal is that I use some User entity, on which I want to define some display var policy. The strategy is somehow the same for all the projet, but the user entity is searched through…
user2626210
  • 115
  • 5
  • 13
0
votes
2 answers

FOSRestBundle is not considering the format in my URL

I want to consider the format extension in my URLs so that it takes the highest priority for the _format parameter. My configuration is the following one: fos_rest: param_fetcher_listener: true view: view_response_listener: 'force' …
Bertuz
  • 2,390
  • 3
  • 25
  • 50
0
votes
1 answer

JMSSerializerBundle Not a integer value on Json

I'm using JMSSerializerBundle for deserializer a json on an API, so I wanna check if the values are correct so I'm using Symfony annotation validation, but when on integer value the json have a string value JMSSerializerBundle put how default value…
fredpalas
  • 66
  • 7
0
votes
1 answer

How to handle edge case for a subscriber to not act on a specific object using the JMS/Serializer library?

I am using the JMS/Serialzier library. I have setup an Event-Subscriber, which listens for Events::PRE_SERIALIZE and I then convert all the object instances of an the class Price having the property currency and amount into different…
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
0
votes
0 answers

Symfony 2 - JMS Serializer - Adding CSV Support

I am currently building an API and it is a requirement to have the option to get the data in a CSV format. I want this to work in the same way as it works for 'xml'. By this i mean i need to be able to add '.csv' to the end of the URL and this would…
Neil
  • 766
  • 1
  • 8
  • 23
0
votes
2 answers

JMS deserialize JSON and fit to the Model Class

First of all, sorry about my english.. I'll try to express in the better way. I'm building an API Rest in Symfony 2.7 with JMSSerializerBundle. I got a Customer model with address properties separated: (line1, line2, city, postal_code, state,…
1 2 3
14
15