Skip to content

Instantly share code, notes, and snippets.

@trans
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trans/d9a1f35b87d8e9cbf86f to your computer and use it in GitHub Desktop.
Save trans/d9a1f35b87d8e9cbf86f to your computer and use it in GitHub Desktop.
Indention or Double Brackets for Super INI
[section]

  [subsection1]
  key1=value1
  key2=value2

  [subsection2]
  key1=value1
  key2=value2

or

[section]

[[subsection1]]
key1=value1
key2=value2

[[subsection2]]
key1=value1
key2=value2
@ingydotnet
Copy link

; Doesn't this already work?
[section "subsection1"]
key1=value1
key2=value2

[section "subsection2"]
key1=value1
key2=value2

@trans
Copy link
Author

trans commented Jul 3, 2014

I should clarify that I mean nested sections. My examples would translate to JSON as:

{ "section" => { "subsection1" => { "key1"=>"value1", "key2"=>"value2" },
                 "subsection2" => { "key1"=>"value1", "key2"=>"value2" } } }

@trans
Copy link
Author

trans commented Jul 3, 2014

But now that I look at your example again, maybe that's what you meant too. I have just never seen that notation before and there seems to be no mention of it on Wikipedia.

Note, TOML is using something similar:

[section.subsection1]
key1=value1
key2=value2

[section.subsection2]
key1=value1
key2=value2

@ingydotnet
Copy link

@trans, look in any Git config file. Those are INI, albeit yet another special version of INI.

This doesn't really nest in any way that I can see.

Also take a look at JSONY. https://github.com/ingydotnet/jsony-pm#readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment