xpdo icon indicating copy to clipboard operation
xpdo copied to clipboard

[Q] Deprecate toJSON and fromJSON?

Open Mark-H opened this issue 3 years ago • 3 comments

In the MODX deprecations issue there's the question of toJSON and fromJSON utilities, and wether that's still necessary or should be removed.

I'd say deprecating them would be a pretty safe bet these days.

Mark-H avatar Oct 19 '21 00:10 Mark-H

For those working with and writing APIs, the removal of fromJSON and toJSON would be catastrophic. I have even suggest the addition of toXML and fromXML. Do not forget there was a huge push for REST in MODX.

wshawn avatar Feb 07 '22 15:02 wshawn

It would certainly be a breaking change which requires deprecating it before removing to make sure people currently using it are notified before it's actualy gone...

... but how is it catastrophic when json_encode and json_decode are equivalent and have been widely supported for like a decade? A basic find and replace could update a codebase in like 30 seconds.

Mark-H avatar Feb 07 '22 15:02 Mark-H

Catastrophic is an overstatement, I admit. From an API developer standpoint having the output data types closest to the raw data is the best -- especially as databases have a native json fieldtype. I will make changes on my two year old xpdo3 applications.

wshawn avatar Feb 07 '22 16:02 wshawn