# JSON

JavaScript Object Notation, or JSON, is human-friendly, more compact than XML, uses UTF-8 encoding, and is universally understood by web browsers, so it's a natural choice for standalone files and for sharing on the web.

Because JSON is hierarchal, XARK's hierarchy can be represented directly in the file, there is no need for (and there should not be) explicit parent properties pointing back to the parent record.

  • Xark
    • Artifact...
      • Subject...
        • Claim...
          • Note...

The Xark node is the top-level record of the JSON store. It contains an array of IArtifact.

All properties in JSON format should be in camelCase.

TypeScript definitions are available to help in authoring and validating XARK records.

# TypeScript Definitions

import { XarkId } from "./ValueTypes"

interface IRecord {
	id: XarkId
	revisionId: XarkId
}

export { IRecord }
import { IArtifact } from "./IArtifact";
import { IRecord } from "./IRecord";

interface IXark extends IRecord {
	artifacts: IArtifact[];
}

export { IXark };
import { ISubject } from "./ISubject"
import { IClaim } from "./IClaim"
import { IEvent } from "./IEvent"
import { IRecord } from "./IRecord"

interface IRange {
	start: number
	end: number
}

interface IArtifact extends IRecord {
	range?: IRange
	subjects?: ISubject[]
	events?: IEvent[]
}

export { IArtifact, IRange }
import { XarkUri } from "./ValueTypes"
import { IRecord } from "./IRecord"
import { IClaim } from "./IClaim"

interface ISubject extends IRecord {
	type: XarkUri
	claims?: IClaim[]
}

export { ISubject }
import { XarkId, XarkDate, XarkUri } from "./ValueTypes"
import { IRecord } from "./IRecord"
import { IPosition } from "./IPosition"
import { INote } from "./INote"

interface IClaim extends IRecord {
	subject: XarkId
	category: "Fact" | "Relationship" | "Role"
	type: XarkUri
	value?: string | number | IPosition | XarkId | XarkUri
	veracity?: "False" | "Probably False" | "Possibly True" | "Probably True" | "True"
	private?: boolean
	notes?: INote[]
}

export { IClaim }
import { IRecord } from "./IRecord"
import { XarkUri } from "./ValueTypes"

interface INote extends IRecord {
	author: XarkUri
	note: string
	type?: "text/plain" | "text/html" | "text/markdown"
	private?: boolean
}

export { INote }
import { XarkId, XarkDate, XarkUri } from "./Aliases";
import { IRecord } from "./IRecord";

interface IEvent extends IRecord {}

export { IEvent };