G
G
GK5662018-10-11 18:14:40
JSON
GK566, 2018-10-11 18:14:40

How to create a dynamic JSON file?

Hello!
On many sites, I noticed that the data is selected not just by some API, but directly to a file with the json extension. For example:
example.com/movies.json
How to make such a "dynamic" json file? Or is it just a trick made with .htaccess and the return comes from, for example, a PHP file?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Timofeev, 2018-10-11
@webinar

as a rule, this file is dynamic, but not a fact, there is no trick here, just the request goes through php and it forms a valid json in response

F
frees2, 2018-10-11
@frees2

In principle, you can write .htaccess php for a specific JSON, as well as for CSS.
But I think it’s somehow smarter done there, the same thing in Google, I don’t even know what’s “inside” there.

I
Ivan Shumov, 2018-10-11
@inoise

It doesn't matter what the address is, and it doesn't even matter what the json headers are. There are several layers:
* Request URL - you can send any address to any file - even to static, even to an executable script
* backend - there may be a generated file, or maybe the same executable script
* response - in which the headers indicate that what type of data is being returned. The script can control it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question