Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does anyone know a demo JSON server? [closed]

Tags:

json

testing

demo

I am building a library that makes calls to a server that returns JSON. I'd like to be able to test this library. This would require my testing code to make a call to a working server that returns JSON. Does anyone know of a server that is suitable for this purpose?

like image 744
Erik Schierboom Avatar asked Mar 30 '13 10:03

Erik Schierboom


People also ask

What is JSON server used for?

A common use of JSON is to exchange data to/from a web server. When receiving data from a web server, the data is always a string. Parse the data with JSON.

Why JSON server is not recognized?

Use npx to solve the error "json-server is not recognized as an internal or external command, operable program or batch file", e.g. npx json-server --watch db. json or install the package globally by running npm install -g json-server . The fastest way to solve the error is to use the npx command.

How do I open a JSON server?

We just need to use the --port number flag. For example: json-server --watch db. json --port 3004.


1 Answers

There is a great server located at http://echo.jsontest.com that does precisely this. You can even determine the output by changing the URI you call.

For example, the http://echo.jsontest.com/key/value URI returns this:

{"key": "value"}

And the http://echo.jsontest.com/key/value/otherkey/othervalue URI returns:

{
   "otherkey": "othervalue",
   "key": "value"
}

The server is also very fast, ideal for testing purposes.

like image 176
Erik Schierboom Avatar answered Oct 08 '22 06:10

Erik Schierboom