JsonGenerationException

0
We see these errors with a lengthy stack trace, but no obvious indicator of where the error is thrown fromThe error is this, which is fairly self explanatory - some kind of JSon serialization process is expecting a value, finding none, therefore (I'm guessing) serialization failsCan not write a field name, expecting a valueI would guess this is happening in our REST publish endpoints, but with the information we have, hard to debug.
asked
1 answers
1

This error usually happens while Jackson is creating JSON. It means a field name was written, but its value was not written, or was written in the wrong order. Because of this, the generated JSON becomes invalid (malformed). Mendix Support also describes this as malformed incoming or outgoing JSON.


1) Check the traffic: enable REST / WebService logs

The first thing to do is to see the request and response payloads of the endpoint. Enable the REST and WebServices log nodes (and Connector if it appears in the stack trace) and check what data is actually being sent or returned.


2) Check the returned data and mappings

For Published REST endpoints, review the returned structure:


  • Make sure no field returns an empty or invalid value.
  • Check for type mismatches (for example enum vs string).
  • If you use import or export mappings, make sure the payload matches the mapping definition.



answered