How to note data source in a data JSON file? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to note data source in a data JSON file? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have a few data JSON files similar to this and I want to include a line to note the sources as simple as //source: Cambodia Department of Injustice but JSON files should contain only data.

Should should it be done?

Answer

If you can change the data structure slightly, you could add a level for metadata:

{
    "metadata": {
        "source": "Cambodia Department of Justice",
        "source-date": "2015-12-15",
        "note": "Ha ha made you look"
    },
    "countries": {
        "USA": { some data }
        "Canada": { Some data }
    }
}

This is cleaner than use a fake “non-data” country.

We are here to answer your question about How to note data source in a data JSON file? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji