Custom JSON De-serializer for PHP

My previous post dealt with taking an object graph and turning it into JSON. If you are building a RESTful web service using PHP and you don’t have the option of using frameworks like Jersey for Java or just prefer doing things in PHP then you also might find the following de-serializer useful. It is not complete in its current form but I chose to share it as is in case someone needed an idea of how to accomplish this.
Continue reading

Posted in PHP | Tagged , , , | Leave a comment

Custom JSON Serializer for PHP

The project I am working on currently requires serializing PHP objects into natural JSON.

After a while it gets a bit old having to transform those objects into key-value pair arrays to then transform them into JSON using json_encode. An alternative would be to make all properties public and then just serialize the objects using json_encode… so much for encapsulation though.

Having worked with Java REST frameworks like Jersey I am used to having plug-able and configurable serializers like JAXB and Jackson. These libraries use intelligent defaults so the amount of configuration and/or annotation is nil or an absolute minimum.

However, as the choice of technology fell on PHP for almost all tiers in the current project I had to come up with an alternative solution producing JSON.

Using F3, a light weight PHP framework for serving up the RESTful JSON endpoints all that was missing was the (fairly) intelligent serializer.
Continue reading

Posted in PHP | Tagged , , , | Leave a comment

Hello world!

Hey, so you have stumbled upon my blog…

Visit again some time, who knows, maybe I will have shared something worth while by then.

Posted in General | Leave a comment