Skip to content

Repository files navigation

Build Status Platforms Documentation

JSON-LD

A JSON-LD library for Swift.

This is an implementation of the JSON-LD specification.

Integration

dependencies: [
    .package(url: "https://github.com/mattmassicotte/JSONLD", branch: "main")
]

Usage

import JSONLD

// decode
let document = try JSONDecoder().decode(ContextOnlyDocument.self, from: jsonldData)

print(document.context)

// encode
let document = ContextOnlyDocument(
    context: [
        "https://www.w3.org/ns/activitystreams",
        "https://w3id.org/security/v1",
        [
            "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
            "alsoKnownAs": [.id: "as:alsoKnownAs", .type: "@id"],
        ],
    ]
)

let data = try JSONEncoder().encode(document)

Contributing and Collaboration

I would love to hear from you! Issues or pull requests work great.

I prefer collaboration, and would love to find ways to work together if you have a similar project.

I use indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace.

By participating in this project you agree to abide by the Contributor Code of Conduct.

About

A JSON-LD library for Swift

Topics

Resources

Code of conduct

Stars

9 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages