# Demo of using format other than HTML?

**URL:** https://discuss.prosemirror.net/t/demo-of-using-format-other-than-html/262
**Category:** Uncategorized
**Created:** [March 29, 2016, 12:23am UTC](https://discuss.prosemirror.net/t/demo-of-using-format-other-than-html/262 "2016-03-29T00:23:20Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![epascarello](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/epascarello/32/140_2.png) [@epascarello](https://discuss.prosemirror.net/u/epascarello)
#### Post date: [March 29, 2016, 12:23am UTC](https://discuss.prosemirror.net/t/demo-of-using-format-other-than-html/262/1 "2016-03-29T00:23:21Z")

</div>

Is there a demo/example code to show loading a format other than HTML in the page?

I saw discussions saying it should be possible with format/schema, but sort of lost on how to actually implement it. My JSON is basically a mapping of portions of document that has their type [heading, paragraph, blockquote, etc], attributes [twitter type of Entities in objects] , and plain text.

Currently I run it through a ractivejs to turn it into HTML to hook it up, but would like to skip that step (if possible.)

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)
#### Post date: [March 29, 2016, 7:36am UTC](https://discuss.prosemirror.net/t/demo-of-using-format-other-than-html/262/2 "2016-03-29T07:36:51Z")

</div>

You could write your own function that converts your format to a `Node` object representing the ProseMirror document it corresponds to. There’s no demo of that yet.

---

<div class="post-metadata">

### Author: ![epascarello](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/epascarello/32/140_2.png) [@epascarello](https://discuss.prosemirror.net/u/epascarello)
#### Post date: [March 29, 2016, 7:29pm UTC](https://discuss.prosemirror.net/t/demo-of-using-format-other-than-html/262/3 "2016-03-29T19:29:08Z")

</div>

So on the demo page, I can copy the `pm.doc` and technically I should be able to take that Object and set the content to a new instance of prosemirror.

What exactly do I need to call to do that? I tried to initialize it with a reference to the object and I tried to use setDoc or setContent and failed.

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)
#### Post date: [March 29, 2016, 7:48pm UTC](https://discuss.prosemirror.net/t/demo-of-using-format-other-than-html/262/4 "2016-03-29T19:48:43Z")

</div>

You can do `var doc = pm.doc` to save a snapshot of the document, then ctrl-a del to clear the editor, and then `pm.setDoc(doc)` to restore it. (That works for me – I just tested it.) Does that answer your question?

---

<div class="post-metadata">

### Author: ![epascarello](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/epascarello/32/140_2.png) [@epascarello](https://discuss.prosemirror.net/u/epascarello)
#### Post date: [March 29, 2016, 8:35pm UTC](https://discuss.prosemirror.net/t/demo-of-using-format-other-than-html/262/5 "2016-03-29T20:35:35Z")

</div>

I was missing converting my JSON with `pm.schema.nodeFromJSON(myObj)`. After that I could use setDoc without any issues.
