# vtk/vtp to vtk.js

**URL:** https://discourse.paraview.org/t/vtk-vtp-to-vtk-js/6233
**Category:** Web Support
**Created:** [January 16, 2021, 1:13am UTC](https://discourse.paraview.org/t/vtk-vtp-to-vtk-js/6233 "2021-01-16T01:13:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 16, 2021, 1:13am UTC](https://discourse.paraview.org/t/vtk-vtp-to-vtk-js/6233/1 "2021-01-16T01:13:20Z")

</div>

Is there a way to generate [such](https://kitware.github.io/vtk-js/docs/structures_PolyData.html) polydata object in vtk.js format from either vtk or vtp?

When we load a vtk or vtp file on Paraview glance, this conversion happens through some script. @jourdain, can you please point me to that script that takes a vtk/vtp as an input and generates a vtk.js object?

Is [this](https://vtk.org/doc/nightly/html/classvtkJSONDataSetWriter.html) something that can help me?

---

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 16, 2021, 6:35am UTC](https://discourse.paraview.org/t/vtk-vtp-to-vtk-js/6233/2 "2021-01-16T06:35:40Z")

</div>

As per [this](https://insightsoftwareconsortium.github.io/itk-js/api/node_pipelines.html) page, I seem to be in the right direction.

---

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 16, 2021, 7:54pm UTC](https://discourse.paraview.org/t/vtk-vtp-to-vtk-js/6233/3 "2021-01-16T19:54:22Z")

</div>

I am only with to write polydata in json format that vtk.js understands

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [January 17, 2021, 4:54pm UTC](https://discourse.paraview.org/t/vtk-vtp-to-vtk-js/6233/4 "2021-01-17T16:54:11Z")

</div>

vtp is supported natively with the [vtkXMLPolyDataReader](https://github.com/Kitware/vtk-js/blob/master/Sources/IO/XML/XMLPolyDataReader/index.js) in vtk.js. You should not send a text based format over the wire.

By using one of those methods [setUrl](https://github.com/Kitware/vtk-js/blob/master/Sources/IO/XML/XMLReader/index.js#L336) or [parseAsArrayBuffer](https://github.com/Kitware/vtk-js/blob/master/Sources/IO/XML/XMLReader/index.js#L352).
