Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6825967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:05:34+00:00 2026-05-26T22:05:34+00:00

I want others to be able to create JSON files that my code can

  • 0

I want others to be able to create JSON files that my code can understand. How would I best document what the required / allowed structure is?

Example:

{
    "customer1" : {
        "open-orders" : [
            123,
            456
        ],
        "terms" : [
            "net 30"
        ]
    }, ...
}

How would I state stuff like “on the first level, it’s the customer ID as found in the CRM system. Then ‘terms’ is required to be there and may have between 1 and 3 items in the array. You must not ever call a first-level tag ‘error’ but all other unknown tags are ignored etc. etc.”

In XML I could use a DTD that already captures some of this information, and I could add some additional comments.

But what’s best practice for JSON? Right now I’m playing with a table structure where in the left column I have a valid JSON file according to my structure, which is chopped into chunks, each of which is a row in the table. In the right columns, I then write prose, one chunk/row at a time. I’m not too happy with it. Are there better ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:05:35+00:00Added an answer on May 26, 2026 at 10:05 pm

    JSON is just a serialized representation of your data-structure(s); as such, you should document the data-structure(s) in lieu of the serialized output.

    /**
     * @var object Customer
     */
    var customer = {
        /**
         * @var Number[][]
         */
        "open-orders": [],
        /**
         * @var String[][]
         */
        "terms": []
    };
    

    Also, JSON does not have any data-specification (markup) notation, like XML; whereas XML can also be used to serialize data, it lets you specify the structure of the data (with XSD’s). JSON was not intended to do this and provides no mechanisms for such.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create one MSBuild that will execute two others.. How can i
I want to create a calendar in my application that external users can view.
Many languages have standard repositories where people donate useful libraries that they want others
I want to use designated initializers, but what about the others index that aren't
I've a small project that I want to share with a few others on
I understand this is a subjective question but I want to see how others
I want create a cache so that when an item doesn't exist, only one
I would like the users be able to create their accounts (which stores the
The intent is to create a set of web services that people can reuse.
I have written an assembly I don't want other people to be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.