# How can I insert data from json-ld files?

**URL:** <https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248>\
**Category:** Support\
**Created:** [April 21, 2017, 5:48pm UTC](https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248 "2017-04-21T17:48:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterneorr](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/peterneorr/32/31_2.png) [@peterneorr](https://community.stardog.com/u/peterneorr)\
**Post date:** [April 21, 2017, 5:48pm UTC](https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248/1 "2017-04-21T17:48:43Z")

</div>

I’ve got some files containing RDF data serialized as json-ld. Is there a simple way to add json-ld data to a stardog database?

Thanks,  
Peter

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [April 21, 2017, 6:07pm UTC](https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248/2 "2017-04-21T18:07:02Z")

</div>

Hi Peter,

Assuming your files have a .jsonld or .json extension, `stardog data add` should accept them as-is. If that’s not the extension, you _might_ be able to pass in `--format jsonld` but I’m not 100% sure on that.

---

<div class="post-metadata">

**Author:** ![charbull](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/charbull/32/78_2.png) [@charbull](https://community.stardog.com/u/charbull)\
**Post date:** [April 21, 2017, 6:29pm UTC](https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248/3 "2017-04-21T18:29:31Z")

</div>

Hi Peter,

If you are using the Java API, you can format it while streaming it. I couldn’t make it work through the web API.

aConn.add().io().format(RDFFormat.RDFXML).stream(ontologyInputStream);

Hope that helps,  
Charbel

---

<div class="post-metadata">

**Author:** ![peterneorr](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/peterneorr/32/31_2.png) [@peterneorr](https://community.stardog.com/u/peterneorr)\
**Post date:** [April 21, 2017, 6:55pm UTC](https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248/4 "2017-04-21T18:55:29Z")

</div>

That's exactly what I wanted to do, but my version (4.1.1) complains:  
`No known format matches the file: C:\Users\pneorr\Desktop\scratch-jsonld\default.json`

The online docs don't list jsonld as a supported format. ☹  
[404 | Stardog Documentation Latest](https://docs.stardog.com/man/data-add.html)

Adding --format JSONLD flag causes a different error:  
`'JSONLD' is not a valid RDF format identifier. Acceptable format strings are NTRIPLES, RDF/XML, TURTLE, PRETTY_TURTLE, TRIG, TRIX, N3, NQUADS.`

Adding --format JSON flag does something similar:  
'JSON' is not a valid RDF format identifier. Acceptable format strings are NTRIPLES, RDF/XML, TURTLE, PRETTY\_TURTLE, TRIG, TRIX, N3, NQUADS.

My short term fix was to use protege to save as turtle. (gag)

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [April 24, 2017, 11:54am UTC](https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248/5 "2017-04-24T11:54:37Z")

</div>

Hmm, if changing the filename to a `.jsonld` extension doesn’t do the trick then I’m not sure you could have done it any other way in 4.1.1. I can confirm that this bug has been fixed some time between then and 4.2.4. At least the `.json` part. Apologies for the confusion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [May 8, 2017, 11:54am UTC](https://community.stardog.com/t/how-can-i-insert-data-from-json-ld-files/248/6 "2017-05-08T11:54:40Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
