13

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?

Erik Schierboom
  • 16,301
  • 10
  • 64
  • 81

2 Answers2

27

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.

Erik Schierboom
  • 16,301
  • 10
  • 64
  • 81
  • So, how what URL should I hit to test a POST call? Let's say I have a simple test POST call that send JSON in the body (and not in the URL) like this {"testing":"some value"}... how would I use jsontest to test this call? – zumzum Apr 07 '14 at 18:52
  • @zumzum Just use the same URL but call it using a POST request. – Erik Schierboom Apr 08 '14 at 06:54
  • 1
    Sorry for late comment, but do you know how to echo json with arrays of json objects? – Cԃաԃ Sep 19 '14 at 00:51
  • 1
    @Cԃաԃ I'm sorry, I don't know how to do that. – Erik Schierboom Sep 22 '14 at 10:07
  • 2
    http://echo.jsontest.com is over quota - stopped responding a while ago...can't find a suitable replacement – Moonwalker Dec 02 '15 at 17:16
  • I created an alternative. If you want more features tweet me at @2upmedia, I'll work more on it. CORS-enabled. https://ajaxechoserver-2upmedia.rhcloud.com/ – 2upmedia Dec 30 '15 at 00:50
  • found this, which echoes the request as json: http://scooterlabs.com/echo.json you can also add parameters to the request like: http://scooterlabs.com/echo.json?name=harvey&surname=wallbanger – testpattern May 17 '16 at 15:49
0

You can test your lib with facebook or twitter public api. For exemple : http://search.twitter.com/search.json?q=blue%20angels will return a json object.

Doc here : https://dev.twitter.com/docs/api/1/get/search

RafH
  • 4,504
  • 2
  • 23
  • 23
  • 4
    Twitter API v1 are now deprecated; the new v1.1 requires authentication, so no more "fire and forget"! – Takhion Jul 30 '13 at 10:17