Skip to content

Json Structure

NonlinearFruit edited this page Aug 11, 2023 · 4 revisions

Every json file includes a Metadata and Data attribute on the root object. The metadata structure is identical across every file. The data varies depending on the CreedFormat but there are some conventions.

Json Conventions

  • The bulk text of a creed should be in Content attributes

Metadata Structure

This is the header information that every creed should have. Read the schema here!

{
  "Metadata": {
    "Title": "",
    "AlternativeTitles": [""],
    "Year": "",
    "Authors": [""],
    "Location": "",
    "OriginalLanguage": "",
    "OriginStory": "",
    "SourceUrl": "",
    "SourceAttribution": "",
    "CreedFormat": ""
  }
}

Creed Formats

There are several 'formats' to these creeds. Here are the big 4 and what they are called.

Creed

This format is named such due to most of the earliest creeds falling into this category. It is just one string of text without any other structure. This string of text could have multiple paragraphs but will not have sections, chapters or the like. Read the schema here!

{
  "Data": {
    "Content": "..."
  }
}

Canon

This format needed a name and so it has one. Though maybe 'Consensus' would be more fitting. It is a list of titled strings (ie: paragraphs). Read the schema here!

{
  "Data": [
    {
      "Article": "",
      "Title": "",
      "Content": "..."
    }
  ]
}

Confession

This format is named after the Westminster Confession. It has a list of chapters, each with a list of sections. Read more about this schema here!

{
  "Data": [
    {
      "Chapter": "",
      "Title": "",
      "Sections": [
        {
          "Section": "",
          "Content": "..."
        }
      ]
    }
  ]
}

Catechism

The only format with an intuitive name. It is a list of question/answer pairs. Read more about the schema here!

{
  "Data": [
    {
      "Number": "",
      "Question": "...",
      "Answer": "..."
    }
  ]
}

Proof Texts

Any object with a Content attribute could optionally have proof texts for that content.

{
  "Content": "...",
  "ContentWithProofs": "...",
  "Proofs": [
    {
      "Id": "",
      "References": [""]
    }
  ],
  "ProofsWithScripture`": [
    {
      "Id": "",
      "References": [""]
    }
  ]
}

Handy Dandy Scripts

Add metadata to existing json:

jq '{ "Metadata": { "Title": "", "AlternativeTitles": [""], "Year": "", "Authors": [""], "Location": "", "OriginalLanguage": "", "OriginStory": "", "SourceUrl": "", "SourceAttribution": "", "CreedFormat": "" }, "Data": . }' ten_theses_of_berne.json

Convert Reformed Standards confession into Creeds.json confession:

yq '.|{ Metadata: {Title: .name, Year: .publication_year, AlternativeTitles:[], Authors:[], Location: null, OriginalLanguage: null, OriginStory: null, SourceUrl: null, SourceAttribution: "Copyright - Reformed Standards", CreedFormat: "Confession"}, Data: [.chapters[] | {Chapter: .number  | tostring, Title: .name, Sections: [.articles[] | {Section: .number | tostring, Content: .text | gsub("\\[[a-z]\\]";"") | sub("\n$";""), ContentWithProofs: .text | sub("\n$";""), Proofs: [.verses |  to_entries[] | {Id: .key, References: .value}] }]}]}' file.yml
Clone this wiki locally