Convert HTML to JSON in react-native Convert HTML to JSON in react-native json json

Convert HTML to JSON in react-native


There is no issue in using the package you have mentioned in React Native. Everything works as expected given you have followed all required steps:

Install himalaya:

cd project_dirnpm install himalaya

Add the required import at the top of your file:

import {parse} from 'himalaya';

Set the html property in state somewhere in your code, before parsing the HTML result:

this.setState = { html: '<div>Example HTML content</div>' };

Convert the HTML into JSON with parse object:

const html = this.state.html;const json = parse(html);alert(JSON.stringify(json));

You can check the code above works as expected in this Snack.