At present we don’t have direct functionality in @inrupt/solid-client for this. Off top of head, you’d need to go through toRdfJsDataset and then use that to serialise to JSON-LD.
As an aside, in your code above the first argument to getThing would be dataset not pod.
Here’s how the solidThing.toJSONLD() method for converting a single thing from a Solid Dataset, to JSON-LD looks to me at the moment:
// 1. **`getDataset`**: Retrieves all things from a container in a given endpoint.
const pod = await getSolidDataset(endpoint, options);
// 2. **`getThing`**: Retrieves a single thing from the Solid dataset
const thing = getThing(pod, endpoint);
// 3. **`createSolidDataset`**: Create a new Solid dataset just for that thing
let dataset = createSolidDataset();
// 4. **`setThing`**: Set that thing to its dedicated Solid dataset
dataset = setThing(dataset, thing);
// 5. **`toRdfJsDataset`**: Serialize that Solid dataset to an RDF/JS dataset
const rdfJsDataset = toRdfJsDataset(dataset);
// 6. **`rdfJsDataset.match`**: Serialize the RDF/JS dataset to Quads
const quads = rdfJsDataset.match();
// 7. **`new JsonLdSerializer()`**: Create a new JSON-LD serializer
const serialiser = new JsonLdSerializer();
// 8. **`serializer.write(quad)`**: Add every quad to the serializer
for (const quad of quads)
serialiser.write(quad);
serialiser.end();
// 9. **`stringifyStream(serializer)`**: Generate string with JSON-LD resulting serialization
const result = stringifyStream(serialiser);
// 10. **`JSON.parse`**: Parse JSON-LD string to JSON for use in code
const parsed = JSON.parse(await result);
Additionally, one could compact that JSON-LD with a given context using:
Ah, I just realised that you can also skip solid-client for getting the Thing, since you’re already calling match, which does that:
// 1. **`getDataset`**: Retrieves all things from a container in a given endpoint.
const pod = await getSolidDataset(endpoint, options);
// 2. **`toRdfJsDataset`**: Serialize that Solid dataset to an RDF/JS dataset
const rdfJsDataset = toRdfJsDataset(pod);
// 3. **`rdfJsDataset.match`**: Extract the RDF/JS dataset's Quads that have `endpoint` as their Subject (i.e. a Thing)
const quads = rdfJsDataset.match(endpoint);
// 4. **`new JsonLdSerializer()`**: Create a new JSON-LD serializer
const serialiser = new JsonLdSerializer();
// 5. **`serializer.write(quad)`**: Add every quad to the serializer
for (const quad of quads)
serialiser.write(quad);
serialiser.end();
// 6. **`stringifyStream(serializer)`**: Generate string with JSON-LD resulting serialization
const result = stringifyStream(serialiser);
// 7. **`JSON.parse`**: Parse JSON-LD string to JSON for use in code
const parsed = JSON.parse(await result);