copypaster
copypaster copied to clipboard
Clarify advantages of using tree notation over other formats
making forms copy-pastable is a neat idea! but i feel like the same benefits could be achieved by simply making web forms serializable to any suitable format of choice, preferably a human-readable/editable one. i think this proposal would benefit from clarifying the unique advantages of using tree notation vs, say, JSON + a schema.
This is a good point! There are lots of little details of why I think Tree Notation (or someone else's similarly minimal notation) would be the best solution for this.
One main reason is that you never need to escape anything (just indent blocks). For instance, let's say the form is for filing a bug report and has a textarea for including source code. Perhaps the form is:
Name [Mary]
SourceCode
[ print "Hello"
print "World" ]
This could serialize to Tree Notation as:
Name Mary
SourceCode
print "Hello"
print "World"
While JSON would require lots of escaping into something like this:
{
"Name": "Mary",
"SourceCode": [
"print": "\"Hello\"\n",
"print": "\"World\""
]
}
Thinking about it more, it seems the best approach would probably to allow the serialization to/from any format when possible as you suggested. I think Tree Notation would work best for most cases, for little detail reasons like the one above, but we could make a toggle or something to add support for other formats as well.