This challenge is straightforward, but hopefully, there are plenty of avenues you can approach it:

You need to print/return a valid JSON object of at least 15 characters, not counting unessential whitespace. Your program should work without any input.

In the interest of clarity, a JSON object starts and ends with curly braces {}, and contains zero or more key:value pairs separated by commas. The full JSON specification can be found at json.org, and the output of your code must pass this validator.

Therefore, any of the following would not be valid:

4                               //Too short, not an object
"really, really long string"    //A string, not an object
["an","array","of","values"]    //An array is not a JSON object
{"this":4      }                //You can't count unessential whitespace
{"1":1,"2":3}                   //Too short
{"a really long string"}        //Not valid JSON, it needs a value
{'single-quoted':3}             //JSON requires double-quotes for strings

However, the following would be valid:

{"1":1,"2":2,"3":3,"4":4}       //Long enough
{"whitespace      ":4}          //This whitespace isn't unessential

Non-programming languages are allowed on this challenge. You may return a string from a function, or print it out. This is a , so answer it with as little code as possible!

  • 1
    \$\begingroup\$ I like the variety of answers on this one \$\endgroup\$ – Robert Fraser Oct 25 '16 at 6:59
  • \$\begingroup\$ Hmmmm, your definition of JSON is limited. What about code that ouputs valid JSON but does not output curly braces? \$\endgroup\$ – Konijn Oct 25 '16 at 13:01
  • 4
    \$\begingroup\$ @Konijn like I said, it must be a valid JSON object. The object is defined by the curly braces. \$\endgroup\$ – Nathan Merrill Oct 25 '16 at 14:01
  • \$\begingroup\$ Got it, with stress on object ;) \$\endgroup\$ – Konijn Oct 25 '16 at 14:06
  • 1
    \$\begingroup\$ @Masterzagh Unfortunately, a native JS object doesn't count. "You may return a string from a function, or print it out" \$\endgroup\$ – Nathan Merrill Feb 2 '17 at 15:05

70 Answers 70


Groovy, 43 Bytes


It gives the range 1-9 in JSON stored for i:


Groovy on Grails, 31 Bytes

def v(){render(params as JSON)}

Controller method, renders the parameters which always include action, controller and a few other meta parameters which results in:

{"action":"v","format":null,"controller":"<Controller Name>"}

When you visit the URL:

http://localhost:8080/<Controller Name>/v
  • \$\begingroup\$ Your program should take no input. \$\endgroup\$ – Nathan Merrill Oct 25 '16 at 17:02
  • \$\begingroup\$ @NathanMerrill fixed, the only cool part to my answer is the Grails part anyway. \$\endgroup\$ – Magic Octopus Urn Oct 25 '16 at 17:05

Boring answers with literals

Emotinomicon, 32 bytes

😭}1:"        r"{😲⏪⏬⏩

Minecraft, 19 bytes

say {"           ":0}

Or not so boring, but not guaranteed

say @p

And just use the JSON as username

Any texteditor, 15 bytes

Couldn't get it any shorter with copy-pasting


Notepad, 7 bytes


Thanks to @ETHProductions

  • \$\begingroup\$ I forgot about the qoutes and noticed ah I need 11 chars as key. \$\endgroup\$ – Roman Gräf Oct 25 '16 at 19:25
  • \$\begingroup\$ {":1234}<ctrl+a><ctrl+c><right-arrow><ctrl+v> is 15 keystrokes, I suppose, but that's not any shorter, and I'm not sure it would count... \$\endgroup\$ – ETHproductions Oct 25 '16 at 19:33
  • \$\begingroup\$ Yes I tries some copy-pasting but got the same problem you got. :( \$\endgroup\$ – Roman Gräf Oct 25 '16 at 19:34
  • \$\begingroup\$ In Notepad on Windows 7 (perhaps other OSs too), you can do {"<F5>":0} for a grand total of 7 keystrokes (F5 inserts the time/date, e.g 3:37 PM 10/25/2016). Not sure if that counts either... \$\endgroup\$ – ETHproductions Oct 25 '16 at 19:39
  • \$\begingroup\$ Do you know this html tag which looks like keyboard buttons. You know the one that is sometimes uses in Vim answers. I already searched for it but couldn't find it. \$\endgroup\$ – Roman Gräf Oct 25 '16 at 19:43

Pyke, 11 10 8 bytes


Try it here!


Ruby (cheap), 22 bytes


Lambda function that returns the String object '{"aaaa":"bbbbb"}'

  • \$\begingroup\$ "a":"b"*8 would be shorter. \$\endgroup\$ – Magic Octopus Urn Oct 27 '16 at 17:45
  • \$\begingroup\$ @carusocomputing See my other post. \$\endgroup\$ – dkudriavtsev Oct 27 '16 at 19:16

RAGE!!!, 41 bytes


Since the interpreter compiler transpiler on the esolangs page converts the code to Python 2 via mere string substitution, escaping double quotes should be okay.


C#, 76 bytes

using System;public class P{public void Main(){Console.Write("{\"\":"+1/3d+"}");}}


  • 1
    \$\begingroup\$ If I'm not mistaken, you can omit the using System; and use instead System.Console.Write(...). This can save you 6 bytes \$\endgroup\$ – auhmaan Oct 28 '16 at 15:30
  • 1
    \$\begingroup\$ @auhmaan: D'uh. You're correct. I had that, but I switched from Math.PI to 1/3d since it's shorter. And because I had to use System for both Console.Write and Math.PI it was shorter to use a using. But now I'm not using Math.PI anymore I can, indeed, get rid of the using system. Thanks for pointing that out! \$\endgroup\$ – RobIII Oct 28 '16 at 16:41


10 chars:



{"": "[object Object]"}

Well, maybe. If it doesn't like the bare object:

12 chars:


If it doesn't print returned objects the way we need:

This is cleaner (ES2015, 13 chars, borrowing from another solution):


{"": 9000000000}

  • \$\begingroup\$ “You need to print/return a valid JSON object” – The print/return part is also mandatory. The solutions are expected to be full programs or functions. Your code is a snippet. \$\endgroup\$ – manatwork Oct 31 '16 at 9:01
  • \$\begingroup\$ Hmm I was considering the REPL as a language. \$\endgroup\$ – Steve Bennett Oct 31 '16 at 12:48

Text, 15 Bytes

I'm pretty sure you know that language, and non-programming languages are allowed...

{"hi ":"world"}

Prolog (SWI), 19 bytes


Try it online!


Vim, 13 bytes




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.