#1 Re: mORMot 1 » JSONToObject and TJSONSerializer customization » 2019-09-25 13:36:23

Hi,

Yesterday I tried to use the "ObjectToJSON" function in SynCommons.pas.  However I kept getting "null" as the output. 

Some further searching revealed the following Stack Overflow question where someone ran into the exact same issue and conclusion:
https://stackoverflow.com/questions/488 … ormot?rq=1

I traced the code and came to the same place as the poster in SO, and it seems to me that the code is maybe not working correctly?

However, it's probably likely that I'm maybe just missing something obvious so I'm asking here first before filing a ticket. 

I've written a quick test app/test suite to demonstrate the problem.  It is available here:
https://github.com/ByteJuggler/JSONSeri … ithSynopse

Somewhat related post regarding JSON serialization from the synopse blog: http://blog.synopse.info/post/2012/04/1 … -any-class

Again: Am I missing something obvious or has this routine been broken somewhere along the line? 

Thanks.

Walter

Edit: Never mind! I worked out what I'm missing.  You basically have to also add the mORMot unit to your uses clause, to ensure that TJSONSerializer is set as the default writer instead of TTextWriter.

Board footer

Powered by FluxBB