How to delete an object in JSON?

I have a JSON archive and I want to find and delete one object. How to find and delete an object in a JSON archive?

Example:

{ "themes":[ {"name":"pepito", "thumbnail":"http://nakome.16mb.com/samples/html/admin/", "description":"Simple"}, // Delete this in php --------- {"name":"juanito", "thumbnail":"http://nakome.16mb.com/samples/html/admin/", "description":"Simple" } // ---------------------------- ] } 
+6
source share
1 answer

Without writing your own parser (and considering its php) use json_decode and include it in the object you want to work with unset , then re json_encode result.

This would be the easiest way without having to parse / search for strings.

+10
source

All Articles