Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to query JSON in PHP?

I've used Google, Yahoo, AND Bing, but I can't find any good answers. I've seen jLinq, but I want to be able to query JSON in PHP in hopes of having a not an SQL database, but instead all data storage within the filesystem on my server. No, I don't care how bad it sounds.

Ideas nonetheless? I would think that there would be a PHP class on this.

-----EDIT-----

Guys, thanks for your answers so far, but I don't think that json_encode and json_decode are of much use. What I want to be able to do is encode/decode JSON, and be able to search it for specific keys with specific values. Albeit I have PROVEN to myself that I can do so, it's a lot of code for something that should be so simple. Anything else you have in mind?

like image 420
Ricky Yoder Avatar asked Dec 02 '12 05:12

Ricky Yoder


1 Answers

You can use JsonQ package. This package can query over JSON data like Query Builder.

https://github.com/nahid/jsonq

like image 185
Nahid Bin Azhar Avatar answered Oct 08 '22 11:10

Nahid Bin Azhar