Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to use Comments in JSON

    How to use Comments in JSON

    By RahulAugust 17, 20191 Min Read

    The fact is, JSON file doesn’t support comments. All the content in the JSON file is data. But still you want to add a comment to your JSON file, You can use the data part as the comment. Which can be ignored during the processing of JSON file.

    Advertisement

    The JSON file contains values in name/value combination. You can use “_comment” as name part of JSON (just for example) and the comment text as value of this pair, that can be ignored by the JSON parser. Below is the sample JSON file including comments in JSON data.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    {
        "_comment": "Your comment string goes here...",
        "blog": {
            "name": "TecAdmin",
            "domain": "tecadmin.net",
            "founder": "Rahul Kumar",
            "year": 2013,
            "niche": "Technology and Computers",
            "isactive": true
        }
    }

    This is not the solution but an option to use comments in a JSON file.

    json
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Implementing a Linux Server Security Audit: Best Practices and Tools

    15 Practical Examples of dd Command in Linux

    Iptables: Common Firewall Rules and Commands

    View 3 Comments

    3 Comments

    1. janki thakkar on October 9, 2019 6:56 am

      Thanks for sharing information.

      Reply
    2. Wanderson P Barcelos on September 13, 2019 2:12 pm

      Very Nice,

      not is beatifull, but work.

      Thanks for trick

      Reply
    3. Data Recovery Dubai on September 2, 2019 5:20 am

      {
      “_comment”: “comment text goes here…”,
      “glossary”: {
      “title”: “example glossary”,
      “GlossDiv”: {
      “title”: “S”,
      “GlossList”: {
      “GlossEntry”: {
      “ID”: “SGML”,
      “SortAs”: “SGML”,
      “GlossTerm”: “Standard Generalized Markup Language”,
      “Acronym”: “SGML”,
      “Abbrev”: “ISO 8879:1986”,
      “GlossDef”: {
      “para”: “A meta-markup language, used to create markup languages such as DocBook.”,
      “GlossSeeAlso”: [“GML”, “XML”]
      },
      “GlossSee”: “markup”
      }
      }
      }
      }
      }

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.