Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

JSON has no comments. That disqualifies it immediately.


    {
        “/*These are the ports we use”: “*/”,
        “ports”: [22, 80, 443]
    }


Now, write a json-schema for that.


Can be done by either additionalProperties: true and not specifying the property, or "patternProperties": { "^/\*": { "type": "string" }}.


I'd rather have real comments than this epicycle.


"additionalProperties": true


“Comment”: ”This is a comment that is optional and ignored by code”


"Comment": "but you can only have one per object"


"Comment1": "This is the first comment"

"Comment2": "This is the next comment"

or

"Comments": ["Here is one", "Here is another!"]

or

"Comments": { "Name": "This is the name of the customer", "Age": "This is the age (0 to 1000) of the customer" }

or

"Values": [ {"Name":"Age", "Value":"20", "Comment":"This is the age of the customer"}, {"Name":"Name", "Value":"Mr. Foo Bar", "Comment":"This is the name of the customer"} ]

The only limit is your imagination.


Many JSON dialects do in practice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: