| Bytes | Lang | Time | Link |
|---|---|---|---|
| 017 | Tcl | 170619T221802Z | sergiol |
| 007 | Jsonnet | 240529T180825Z | Digital |
| 016 | dc | 240529T175857Z | Digital |
| 010 | Thunno 2 | 230608T184153Z | The Thon |
| 026 | Trilangle | 230311T180040Z | Bbrk24 |
| 016 | x8664 machine code | 230311T122722Z | m90 |
| nan | 230219T101914Z | The Thon | |
| 012 | jq n | 230219T073121Z | GammaFun |
| nan | 221128T213415Z | bigyihsu | |
| 012 | K ngn/k | 221128T074702Z | doug |
| nan | 161031T055752Z | Steve Be | |
| 004 | ShellSoccarjpn/Parsrs makrj.sh | 221126T073420Z | 鳴神裁四点一号 |
| 008 | Vyxal | 220625T000735Z | naffetS |
| 009 | GNU nano | 210121T004545Z | EasyasPi |
| 014 | Brachylog | 210120T234425Z | Unrelate |
| 021 | Nim | 210120T211012Z | xigoi |
| 013 | Vim | 180602T045309Z | JoshM |
| nan | 161025T181409Z | Linnea G | |
| 019 | Prolog SWI | 180529T214929Z | ASCII-on |
| 020 | Java JDK 10 | 161025T094304Z | Olivier |
| 001 | Japt Q | 180528T045736Z | Bubbler |
| 009 | Dyalog APL | 161026T092235Z | Adá |
| 116 | Java 8 Full Program | 170619T101552Z | Llew Val |
| 017 | PowerShell | 170619T234429Z | Chirishm |
| 013 | 05AB1E | 170202T141742Z | Magic Oc |
| 027 | SmileBASIC | 170201T213939Z | 12Me21 |
| 012 | Pushy | 170201T215255Z | FlipTack |
| 019 | Ruby | 161025T015511Z | anna328p |
| 007 | Notepad | 161025T194359Z | ETHprodu |
| 050 | TSQL2016 only | 161122T194626Z | dfundako |
| 015 | Text | 161122T183949Z | univalen |
| 021 | Rust | 161107T130619Z | user6126 |
| 013 | Python 2 | 161030T155539Z | Noodle9 |
| 018 | Bash | 161029T000548Z | Isaac Ha |
| 039 | C# | 161028T230448Z | Travis J |
| 027 | Actionscript 3 | 161028T204125Z | Brian |
| 017 | JavaScript | 161028T201052Z | Travis J |
| 076 | C# | 161026T152000Z | RobIII |
| 006 | jq | 161025T082230Z | manatwor |
| 016 | ECMAScript 2015 | 161027T091941Z | Toothbru |
| 041 | RAGE!!! | 161027T012026Z | user8397 |
| 007 | Charcoal | 161026T232733Z | DLosc |
| 016 | Batch | 161025T120813Z | Neil |
| 022 | Ruby cheap | 161026T170404Z | anna328p |
| 015 | HQ9+ | 161025T202511Z | ETHprodu |
| 014 | Javascript | 161026T163926Z | nl-x |
| 016 | CoffeeScript | 161025T182217Z | ETHprodu |
| 019 | R | 161025T075039Z | JDL |
| 010 | Actually | 161026T052826Z | user4594 |
| 015 | JavaScript | 161025T015634Z | jrich |
| 023 | Crystal | 161025T205209Z | Zatherz |
| 010 | Windows batch | 161025T201346Z | penalosa |
| 008 | Pyke | 161025T201840Z | Blue |
| 167 | Addict | 161025T192221Z | ETHprodu |
| 015 | JavaScript ES6 + jQuery | 161025T195325Z | ETHprodu |
| 014 | Cheddar | 161025T180147Z | ETHprodu |
| 026 | Myth | 161025T181255Z | Conor O& |
| 014 | q | 161025T123730Z | skeevey |
| 024 | Common Lisp | 161025T174204Z | coredump |
| 014 | /// | 161025T091055Z | manatwor |
| 043 | Groovy | 161025T165631Z | Magic Oc |
| 030 | C++11 | 161025T144928Z | Karl Nap |
| 011 | Japt | 161025T140232Z | ETHprodu |
| 014 | PowerShell 14 Bytes | 161025T120340Z | Matt |
| 036 | Java 7 | 161025T080508Z | Kevin Cr |
| 013 | PHP | 161025T082714Z | user5917 |
| 015 | Perl 5 | 161025T115004Z | simbabqu |
| 019 | R | 161025T074233Z | Billywob |
| 023 | IBM/Lotus Notes @Formula | 161025T101945Z | ElPedro |
| 011 | Retina | 161025T093851Z | Dom Hast |
| 019 | PHP | 161025T081438Z | ʰᵈˑ |
| 009 | 05AB1E | 161025T064558Z | Emigna |
| 050 | Brainfuck | 161025T051254Z | Sp3000 |
| 012 | Jelly | 161025T015651Z | Jonathan |
| 014 | Python 2 | 161025T015736Z | xnor |
| 083 | brainfuck | 161025T033105Z | DanTheMa |
| 005 | Pyth | 161025T032102Z | Maltysen |
| 015 | Turtlèd | 161025T025926Z | Destruct |
| 018 | Element | 161025T025025Z | PhiNotPi |
| 009 | V | 161025T023445Z | DJMcMayh |
| 007 | Pyth | 161025T023138Z | Steven H |
| 011 | Jelly | 161025T022330Z | Dennis |
| 009 | Jolf | 161025T021942Z | Conor O& |
| 018 | Perl | 161025T021515Z | Gabriel |
Thunno 2, 10 bytes
ẠṘ"{%:0}"Œ
Explanation
ẠṘ"{%:0}"Œ # Full program
"{%:0}" # Template string "{%:0}"
Œ # With the "%" replaced by
Ṙ # A quoted version of
Ạ # The lowercase alphabet
# Implicit output
Trilangle, 26 bytes
"{"o:o"o,S"!So"o"o*}@o,o!o
Try it on the online interpreter.
Most of this is just spent shuffling punctuation around. Prints out
{"":58
,"":1972
}
Which, while not particularly useful, is accepted by JSON.parse. The first number is the value of ':' and the second number is '"' * ':'.
Trilangle, no duplicate keys, 30 bytes
"{:ooS"!oo""SS!o,oo"oooS*}@.",
Prints out:
{"":58
,":":1972
}
x86-64 machine code, 16 bytes
B8 7B 22 3A 20 AB AB AB AB C7 07 30 7D 7D 00 C3
Produces {": {": {": {": 0}}.
Following the standard calling convention for Unix-like systems (from the System V AMD64 ABI), this takes in RDI a memory address at which to place the result, as a null-terminated byte string.
In assembly:
f: mov eax, '{' | '"'<<8 | ':'<<16 | ' '<<24
# Put this value in EAX.
stosd # Write it to the output string, advancing the pointer.
stosd # Again.
stosd # Again.
stosd # Again.
mov DWORD PTR [rdi], '0' | '}'<<8 | '}'<<16 | 0<<24
# Add this value to the output string.
ret # Return.
Thunno KJ, \$ 13 \log_{256}(96) \approx \$ 10.70 bytes
":0}"'"AZ'"'{
Prints {"ABCDEFGHIJKLMNOPQRSTUVWXYZ":0}
Explanation
Since Thunno's stack is reversed, we'll go right to left:
":0}"'"AZ'"'{ # STACK:
'{ # Push "{" {
'" # Push '"' { "
AZ # Push the alphabet { " ABCDEFGHIJKLMNOPQRSTUVWXYZ
'" # Push '"' { " ABCDEFGHIJKLMNOPQRSTUVWXYZ "
":0}" # Push ":0}" { " ABCDEFGHIJKLMNOPQRSTUVWXYZ " :0}
# Flags: join stack {"ABCDEFGHIJKLMNOPQRSTUVWXYZ":0}
# Implicit output
jq -n, 12 bytes
""|match("")
env does not always satisfy the requirement. It depends on the environment, which could even be empty, outputting {}. This solution yields the same result every time:
{
"offset": 0,
"length": 0,
"string": "",
"captures": []
}
Go, 47 bytes
import."fmt"
func f(){Print(`{"X":10,"Y":20}`)}
To STDERR, 32 bytes
func(){print(`{"X":10,"Y":20}`)}
JavaScript (REPL)
10 chars:
{"":{}+''}
Output:
{"": "[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):
`{"":${9e9}}`
{"": 9000000000}
ShellSoccar-jpn/Parsrs makrj.sh, 6 5 4 bytes
Tested with version Wed Sep 14 22:19:55 JST 2016, which is the latest version before this problem was created.
.../
outputs (18 bytes w/o LFs)
{
"":{
"":{
"/":""
}
}
}
Explained
makrj.sh is a POSIXism utility to generate a JSON object from a list of JSONPath-indexed values developed by ShellShoccar-jpn. The input shall be lines of <key> <value>.
.../ # define an implicit value "" with 3-level key whose
. # 1st-level key name is ""
. # 2nd-level key name is ""
./ # and 3rd-level key name is "/"
Try this (bash+curl)
printf '.../' | sh <(curl https://raw.githubusercontent.com/ShellShoccar-jpn/Parsrs/666042eddeb41406ee4a1e4831a01b0aac5af211/makrj.sh)
GNU nano, 9 keystrokes
{" ":0}
{ " META+o Tab Tab " : 0 }
{ ": literal {"
META+o: switch to tabs-to-spaces mode
Tab Tab: Tab to the second tab stop (tab stops are 8 by default). Since we enabled tabs to spaces, these will be converted to 14 spaces.
" : 0 }: literal ":0}
It is a very interesting JSON string with a very interesting input method, if you ask me.
Video demo done in Termux to visualize keystrokes (ALT is META)
Vim, 13 keystrokes
a{"<esc>9aa<esc>a":0}
Outputs
{"aaaaaaaaa":0}
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
{"123456789":0}
Notepad, 7 keystrokes
{"F5":1}
Thanks to @ETHProductions
Japt -Q, 1 byte
M
The output is {"P":3.141592653589793,"Q":1.618033988749895,"T":6.283185307179586}.
How it works
M is a shorthand for JS's Math object, with one-char aliases to existing functions/constants and some extra functions/constants. The constants shown here are:
M.P = Math.PIM.Q = Golden Ratio = (Math.sqrt(5)+1)/2M.T = Math.PI * 2
And the boring part: the -Q flag applies JSON.stringify to the output value. Some of the properties are lost (e.g. Math.E and Math.SQRT2), but we still have the above three values and the result is well over 15 characters.
Dyalog APL, 9 bytes
⎕JSON⎕DMX
In a clean workspace on my PC the result is
{"Category":"","DM":[],"EM":"","EN":0,"ENX":0,"HelpURL":"","InternalLocation":["",0],"Message":"","OSError":[0,0,""],"Vendor":""}
⎕JSON convert to JSON
⎕DMX the (universally available) Diagnostic Message Extended object
Java 8 (Full Program), 125 Bytes 123 Bytes 116 Bytes
Yes, I know there are shorter ways in Java, as posted above. I just wanted to approach it from a looping perspective.
Thanks to ais523 for saving 2 bytes.
Thanks to Manatwork for saving 7 bytes.
interface C{static void main(String[]a){for(int i=0;i++<9;)System.out.print(i<2?"{":"\""+i+"\":"+i+(i>8?"}":","));}}
Ungolfed
interface C{
static void main(String[]a){
//Loop from 0-8, add one to i at start of loop instead of end though
for(int i=0;i++<9;)
//If it is a start case simply print { otherwise print "i":i
//If it is an end case also print } otherwise also print :
System.out.print(i<2?"{":'"'+i+"\":"+i+(i>8?"}":","));
}
}
PowerShell, 17 bytes
Slightly unclear on how strict the 'no input' thing is, if it's just no user input or of system input is also disallowed. While my best answer isn't shorter than the other PowerShell answer I think it is novel.
ps|ConvertTo-Json
Gets running processes (default return is an object) and converts that object to a json. Several other two and three letter aliases commands work.
Sample output omitted because it's 34115 lines long and trying to redact my username and computername was a pain.
gl|ConvertTo-Json
Gets your current filesystem location (as an object) and converts that object to a json
gci|ConvertTo-Json
Gets the files in your current path (as an object) and converts that object to a json
You can also take things like inherent type definitions (which are part of the language itself) and pipe them into the conversion function.
[xml]|ConvertTo-Json
Gets the definition of the xml datatype and converts that object to a json
[int]|ConvertTo-Json
Gets the definition of the 32bit integer datatype and converts that object to a json
SmileBASIC, 27 bytes
?"{
?CHR$(34)*2;":
?PI();"}
Printing quotation marks is a huge pain in BASIC. 8 bytes wasted!
Output:
{
"":
3.14159265}
Exactly 15 characters, without the whitespace.
Pushy, 12 bytes
`{"`A`":1}`"
This produces the output:
{"ABCDEFGHIJKLMNOPQRSTUVWXYZ":1}
Any text wrapped in backticks is a string literal. The A injects the whole uppercase alphabet. Then, the final " command prints it all.
Ruby, 19 bytes
puts'{"1":'+9**9+?}
Output:
{"1":387420489}
Notepad, 7 keystrokes
If you have a Windows computer with the Notepad program, type this:
{"F5":0}
On my Windows 7 computer, at least, this gives you something like:
{"3:42 PM 10/25/2016":0}
TSQL(2016 only), 50 BYTES
SELECT*FROM(VALUES(GETDATE()))AS A(a)FOR JSON PATH
Text, 15 Bytes
I'm pretty sure you know that language, and non-programming languages are allowed...
{"hi ":"world"}
Rust, 21 bytes
||"{\"a\":0.1234567}"
String substitution would be too verbose, but at least there's always terse lambdas with implicit returns.
With "test code":
fn main(){
let f=||"{\"a\":0.1234567}";
println!("{}", f());
}
Python 2, 13 bytes
print{"'":.1}
Outputs:
{"'": 0.10000000000000001}
Since tenths can't be stored exactly in binary Python outputs a 1 followed by 15 zeros followed by a 1 after the decimal point. Need double quotes around the single quote to not have the double quotes converted to single quotes (thanks to @JonathanAllan's comment to @xnor's answer).
Bash, 18 bytes
echo {\"$PATH\":1}
This works on Mac and Linux, unless your $PATH isn't set.
C#, 39 bytes
string j(){return"{\""+1.0/0+"\":42}";}
In C#, division of 0 with a double (hence the inclusion of .0), will result in Infinity.
Output:
{"Infinity":42}
Actionscript 3, 27 bytes
trace(JSON.stringify(int));
outputs
{"MAX_VALUE":2147483647,"length":1,"MIN_VALUE":-2147483648,"prototype":{}}
JavaScript, 17 bytes
_=>'{"'+{}+'":0}'
outputs
{"[object Object]":0}
passes validator at jslint
This works because {} will implicitly be cast to string with the + concatenation, and calling toString on an object returns "[object Object]".
C#, 76 bytes
using System;public class P{public void Main(){Console.Write("{\"\":"+1/3d+"}");}}
Output:
{"":0.333333333333333}
jq, 6 characters
(3 characters code + 3 characters command-line option.)
env
CW because I am sure this is not the kind of answer you intended to allow.
Sample run:
bash-4.3$ jq -n 'env'
{
"GIT_PS1_SHOWDIRTYSTATE": "1",
"TERM": "xterm",
"SHELL": "/bin/bash",
"GIT_PS1_SHOWUNTRACKEDFILES": "1",
"XTERM_LOCALE": "en_US.UTF-8",
"XTERM_VERSION": "XTerm(322)",
"GIT_PS1_SHOWSTASHSTATE": "1",
"GIT_PS1_SHOWUPSTREAM": "auto",
"_": "/usr/bin/jq"
}
(Output obviously shortened.)
ECMAScript 2015, 16 bytes
_=>`{"":${9e9}}`
It will run in most modern ECMAScript environments (eg. Firefox, Chrome, MS Edge, Opera, Node…).
RAGE!!!, 41 bytes
<rant>SCREAM"{\"12345\":54321}"!!!</rant>
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.
Charcoal, 7 bytes
{"⁹":9}
Runs of printable ASCII characters in Charcoal form literal strings, and expressions lacking any explicit command are printed. So {" and ":9} are just output verbatim. ⁹, however, is an integer literal, and when you print an integer, you get an ASCII-art line that many characters long. The character used for horizonal lines is the hyphen, so the result is:
{"---------":9}
Conveniently, this is exactly 15 characters.
Batch, 16 bytes
Prints {"Windows_NT":0}.
@echo {"%OS%":0}
Ruby (cheap), 22 bytes
->{'{"aaaa":"bbbbb"}'}
Lambda function that returns the String object '{"aaaa":"bbbbb"}'
HQ9+, 15 bytes
{"Quineland":0}
Outputs itself. I thought an 8-byte answer would be possible, like so:
{":11QQ}
This outputs {":11QQ}{":11QQ}, which is almost valid JSON, but 11QQ is not a valid value.
HQ9+ is not a valid programming language by PPCG standards, but the OP has allowed non-programming languages.
Javascript, 14 bytes
'{"":'+1e9+'}'
Gives:
{"":1000000000}
I know that this doesn't actually print out anything, it merely returns. But so do all other Javascript solutions here.
CoffeeScript, 18 16 bytes
Saved 2 bytes thanks to @Caffeinated.tech
->'{"":'+1/3+'}'
Outputs {"":0.3333333333333333}. Sadly, because of the required double-quotes, string interpolation is a byte longer:
->"{\"\":#{1/3}}"
R, 19 bytes
This works in British English locale; it may require +2 bytes in others. (Edit: it probably doesn't --- see comments.)
cat('{"',pi,'":1}')
I was hoping for something clever (perhaps plucking a line of code out of a pre-existing function like q) but couldn't find anything. The result:
{" 3.141593 ":1}
Note that you don't have to escape double quotes in R if you use single quotes to quote the string (and vice-versa). This behaviour is locale-dependent though. I would expect it to work in a US English locale as well though.
This also requires that your default digits option is at least six (which is the factory-fresh default) and that scipen is at least -digits (the factory-fresh default is zero).
Actually, 10 bytes
'}Qè;':@'{
Explanation:
'}Qè;':@'{
'} push "}"
Q push this program's source code
è call Python's repr function (essentially just wraps the string in double-quotes)
; duplicate
':@ push ":", swap with one copy of double-quoted source code
'{ push "{"
implicitly print each stack item, separated by newlines, starting with the top
Output:
{
"'}Qè;':@'{"
:
"'}Qè;':@'{"
}
JavaScript, 17 15 bytes
Thanks to @Neil for this one. Call with no input.
_=>`{"${_}":0}`
Outputs {"undefined":0}
Old version, 16 bytes
Thanks to @kamoroso94 for -1 on this version
_=>`{"":${9e9}}`
Outputs {"":9000000000}
Crystal, 23 bytes
puts %Q({"#{"a"*9}":0})
You can also avoid using %Q (and keep the same character count):
puts "{\"#{"a"*9}\":0}"
The above return:
{"aaaaaaaaa":0}
Which has exactly 15 characters.
Windows batch, 10 bytes
{"%OS%":5}
The environment variable OS contains the string Windows_NT (On all Windows operating systems since 2000, according to this question on Stack Overflow)
Addict, 200 167 bytes
Addict is a Turing tarpit where the only control flow is user-defined commands.
a A
i 1
i 1
d
a B
A 1
A 1
d
a C
B 1
B 1
d
a D
C 1
C 1
d
D b
D b
D b
D b
D b
D b
D b
C b
B b
d b
D q
D q
A q
c b
c q
c q
D q
C q
c q
n b
n q
n b
n q
A b
c b
This outputs {"":1235812358}. Try it in the online interpreter!
How it works
To golf answer space, I'm going to refer you to the sections Primer on Addict and Act I on "Hello, World!" in Addict. If you already know how that works, feel free to skip this part.
Act II
The rest of the program is devoted to outputting a valid JSON object in as few bytes as possible. In order to minimize the code, we can use the variables that are already set to output a number with the n command. The first step is then to set three variables to the two chars we need at first:
bto 123, the char code of{qto 34, the char code of"
After these have been set, we output {"" one char at a time, then increment q by 24, resulting in 58, the charcode of :. We output that, then output the values of b and q twice, printing 1235812358. The last step is to increment b by 2 to change it to }, and then output it to finish.
If you can find any way to golf this program, please let me know!
JavaScript (ES6) + jQuery, 15 bytes
Because jQuery.
_=>`{"${$}":0}`
Outputs {"function (a,b){return new n.fn.init(a,b)}":0} when called. Try it here:
f=_=>`{"${$}":0}`
alert(f())
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Cheddar, 17 14 bytes
Saved 3 bytes thanks to @ConorO'Brien
->'{":1234}'*2
An anonymous function that returns {":1234}{":1234}, which is a valid JSON object:
{
":1234}{": 1234
}
Myth, 28 26 bytes
{"a":"{\":3141}","_":"aa"}
Saved 2 bytes by adapting the solution given by the /// answer.
Myth is a language similar to Thue, contained in a valid JSON object. How appropriate! Here, _ is the initial state, and replaces a with "****". Output:
{":3141}{":3141}
For clarity, I added some spaces:
{
":3141}{" : 3141
}
Previous solutions
28 bytes: {"a":"\"****\"","_":"{a:a}"}. Outputs: {"****":"****"}
Running
I found the interpreter here:
function(m,y,t,h){m=JSON.parse(m);for(y=m._;h=1;){for(t in m)if(t!="_"&&~y.indexOf(t)){y=y.replace(t,m[t]);h=0;break}if(h)break}return y}
Test it out right here:
function myth(m,y,t,h){m=JSON.parse(m);for(y=m._;h=1;){for(t in m)if(t!="_"&&~y.indexOf(t)){y=y.replace(t,m[t]);h=0;break}if(h)break}return y}
b.onclick=function(){o.innerHTML="";o.appendChild(document.createTextNode(myth(q.value)));}
textarea {
width: 90%;
}
*{font-family:Consolas,monospace;}
<textarea id=q>{"a":"\"****\"","_":"{a:a}"}</textarea>
<br>
<button id=b>execute myth code</button>
<br>
<textarea id=o disabled>output</textarea>
q, 14 bytes
Prints memory usage information about the current process
-1@.j.j .Q.w`;
Sample output:
q)-1@.j.j .Q.w`;
{"used":127392,"heap":67108864,"peak":67108864,"wmax":0,"mmap":0,"mphy":16735457280,"syms":585,"symw":18925}
Common Lisp, 24 bytes
(format t"{~S:~f}""p"pi)
Prints the following to standard output (23 characters long):
{"p":3.141592653589793}
This is a simple string format which uses the predefined constant PI.
///, 15 14 characters
/a/{":1234}/aa
(At least the output is 1 2 characters longer than the code.)
Thanks to:
- ETHproductions for reusing the object delimiters as part of key (-1 character)
Sample run:
bash-4.3$ slashes.pl <<< '/a/{":1234}/aa'
{":1234}{":1234}
Just to make it more readable:
bash-4.3$ slashes.pl <<< '/a/{":1234}/aa' | jq ''
{
":1234}{": 1234
}
Groovy, 43 Bytes
{groovy.json.JsonOutput.toJson([i:1..9])}
It gives the range 1-9 in JSON stored for i:
{"i":[1,2,3,4,5,6,7,8,9]}
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
C++11, 30 bytes
As unnamed lambda, port of jrich's answer, -1 byte thanks to ETHproductions
[](){printf("{\"\":%f}",9e9);}
Usage:
int main(){
[](){printf("{\"\":%f}",9e9);}();
}
Japt, 11 bytes
There are a multitude of 11-byte programs:
`\{"{O}":1} // {"[object Object]":1}
`\{"{M}":1} // {"[object Math]":1}
`\{"{@}":1} // {"function (X,Y,Z){return }":1}
`\{"{_}":1} // {"function (Z){return Z}":1}
`\{"{Ð}":1} // {"Tue Oct 25 2016 12:15:24 GMT-0400 (Eastern Standard Time)":1}
`\{"":{+Ð}} // {"":1477412000095}
The last two use the Date object; thus, they are non-constant, but always output more than 15 bytes. Explanation:
`\{" ":1}` // Take this string,
{O} // inserting variable O here.
// O is an Object, which stringifies to "[object Object]".
// Implicitly output.
More interesting 12-byte version:
`\{":{L²}}`²
Prints {":10000}{":10000}. Explanation:
`\{": }` // Take this string,
{L²} // inserting 100 squared (10000) here,
// (this yields {":10000})
² // and double.
// Implicitly output.
PowerShell 22 20 14 Bytes
'{"":'+1tb+'}'
Output
{"":1099511627776}
Using the constant defined for 1TB in bytes to reach the character limit and the value of a static integer to make for valid json. Thanks to TimmyD for reducing the characters by 5 by removing some redundancy.
Earlier Post 40 Bytes
"{$((1..9|%{'"{0}":{0}'-f$_})-join",")}"
Output
{"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9}
Takes a integer array and creates a key-value pair for each. Join with commas and wrap with a set of curly braces.
Java 7, 36 bytes
String c(){return"{\"a\":"+1e6+"}";}
Java 8, 21 bytes
()->"{\"a\":"+1e6+"}"
Ungolfed & test code:
class M{
static String c(){
return "{\"a\":" + 1e6 + "}";
}
public static void main(String[] a){
System.out.println(c());
}
}
Output (length 15):
{"a":1000000.0}
PHP, 14 13 bytes
{"":<?=M_E?>}
Prints a nice mathsy object that one could almost pretend is useful:
{"":2.718281828459}
Uses the fact that php prints anything outside the tags verbatim to save on some quotation marks, M_E was the shortest long enough constant I could find.
edit: saved one byte thanks to Lynn. Sadly it's no longer a 'nice' mathsy object.
Perl 5, 16 15 bytes
Uses the unix timestamp of the moment the program was started as the content of a one-element object. It gives valid output if you run it later than 10:46:39 on 3rd of March 1973. But since we can't go back in time that seems legit.
say"{\"$^T\":1}"
Uses the FORMAT_TOP_HANDLE variable $^ which defaults to STDOUT_TOP.
say"{\"$^\":1}";
Run with -E flag at no additional cost.
perl -E 'say"{\"$^\":1}";'
Outputs is 16 bytes long.
{"STDOUT_TOP":1}
R, 19 bytes
cat('{"',lh,'":1}')
Becomes a bit longer because the need to escape quotes \". Furthermore, lh is one of the built-in datasets in R and is (to my knowledge) the object with the shortest name that contains the 9 characters needed to fill the length of the key. (edit: turns out pi does the trick as well with the standard option and I was beaten by @JDL who was clever enough to escape using single quotes rather than the extra backslashes)
The description of lh in the R-documentation is:
A regular time series giving the luteinizing hormone in blood samples at 10 mins intervals from a human female, 48 samples.
which is a rather unexpected name of a key, but hey, it works and produces the output:
{" 2.4 2.4 2.4 2.2 2.1 1.5 2.3 2.3 2.5 2 1.9 1.7 2.2 1.8 3.2 3.2 2.7 2.2 2.2 1.9 1.9 1.8 2.7 3 2.3 2 2 2.9 2.9 2.7 2.7 2.3 2.6 2.4 1.8 1.7 1.5 1.4 2.1 3.3 3.5 3.5 3.1 2.6 2.1 3.4 3 2.9 ":1}
The answer can be compared to just padding the key with "random" letters to make the output at least 15 characters (24 bytes):
cat("{\"HeloWorld\":1}")
IBM/Lotus Notes @Formula, 24 23 bytes
Computed value in a Notes field.
"{\"\":"+@Text(@Pi)+"}"
Outputs:
{"":3.14159265358979}
Nothing clever - just uses the shortest possible function that outputs a number then converts it to text for display.
Retina, 11 bytes
{"9$*R":1}
Output
{"RRRRRRRRR":1}
Note: the leading newline is significant as nothing is replaced with the resultant output, I've used a non-breaking space to illustrate this!
05AB1E, 9 bytes
Unfortunately, 05AB1E doesn't have a dictionary object so we have to construct our own.
’{"èÖ":7}
Output
{"dictionaries":7}
Brainfuck, 50 bytes
+[+<---[>]>+<<+]>>+.>>>--.<+++<[->.<]>>.<+.-.<<++.
Outputs {"999999999999999999999999999999999999999999999999999999999999999999999999999999999":9}. Assumes an interpreter that has 8-bit cells and is unbounded on the left. Try it online!
Jelly, 13 12 bytes
“{"":}”s2jȷ4
How?
“{"":}”s2jȷ4 - Main link: no arguments
“{"":}” - literal ['{','"','"',':','}']
s2 - split into twos -> [['{','"'],['"',':'],['}']]
j - join with
ȷ4 - literal 10000 -> ['{','"',10000,'"',':',10000,'}']
- implicit print -> {"10000":10000}
previous (13):
“"11”m0“{:}”j
Python 2, 14 bytes
print{`str`:1}
Outputs:
{"<type 'str'>": 1}
The backticks get the string representation in Python 2. Usually, this outputs inside creates single quotes, which Python recognizes as delimiting a string, but JSON doesn't. But Sp3000 observes that when stringifying a type, the type description already contains single quotes, which forces the outer quotes to be double quotes.
brainfuck, 83 bytes
--[-->+++++<]>.+[---->+<]>+++.>-[>+<-----]>.........<<.[----->+<]>.>.>--[-->+++<]>.
Outputs {"333333333":3}
There is likely another shorter solution, but I have not yet found it.
Explanation:
--[-->+++++<]>. {
+[---->+<]>+++. "
>-[>+<-----]>. 3
........
<<. "
[----->+<]>. :
>. 3
>--[-->+++<]>. }
Turtlèd, 15 bytes
'{r'"10:'"r":3}
Try it online
outputs {" ":3}
Explanation
'{ write {
r move right, off {
'" write "
10 put 10 in register
: move right that many characters (puts spaces in)
'"r write ", move right of that character
":3} write :3}
Element, 18 bytes
\{\"a\"\:`9 9^`\}`
Try it online! Outputs {"a":387420489}
This is only three bytes shorter than the naive solution. The first half of the output is hard-coded (too many escape characters to make any other approach feasible), while the value is calculated as 9^9 to make a number long enough.
V, 9 bytes
i{"¹*":0}
Very straightforward. Enters insert mode, enters the following text:
{"*********":0}
The reason this is so short is because ¹ repeats the following character 9 times.
Pyth, 7 bytes
.d],`G0
Creates a dictionary containing a single key "'abcdefghijklmnopqrstuvwxyz'" and value 0:
.d Dictionary from:
] The single-element list containing:
, The two-element list containing:
`G The representation of the alphabet (the key)
0 and 0 (the value)
Implicitly print the stringification of this.
Jolf, 9 bytes
"{¦q:¦q}"
Outputs: {"{¦q:¦q}":"{¦q:¦q}"}. Try it here!
"{¦q:¦q}"
"{ : }" raw string
¦q insert the source code here
¦q and here
Perl, 18 bytes
say"{'".[2]."':1}"
Prints an array reference in quotes as the name and 1 as the value. Sample output:
{'ARRAY(0x60002b5c0)':1}