[vtkusers] VTK-js: how to read a .json file

Aron Helser aron.helser at kitware.com
Fri Jul 21 10:57:48 EDT 2017


Hi Cristina,
ParaViewWeb uses this webpack 1.x loader:
{
    test: /\.json$/,
    loader: 'json-loader',
  },
That should allow you to 'include' a json file in your javascript, and then
you might need to use the built-in JSON.parse() to turn it into an object.

Regards,
Aron

On Fri, Jul 21, 2017 at 4:43 AM, Cristina Oyarzun via vtkusers <
vtkusers at vtk.org> wrote:

> Dear all,
>
> I visualized several actors using VTK-js. Now I want to read a .json file
> and according to the information that it is included there assign different
> colors to the actors.
>
> Unfortunately as soon as I try to use the Build-in modules of Node.js I
> start getting errors. I didnt manage to find out how do I have to adapt the
> "webpack.config.js" (or the "package.json"?) so that it works.
>
> I found somewhere in a forum that it should work by adding " target:
> 'node' " to the webpack.config.js but it didnt. Any help would be great!
>
> Thank you!
> Cristina
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170721/3a09ac49/attachment.html>


More information about the vtkusers mailing list