spruce_the_data: messy HTML and text to clean JSON
Pricing
from $10.00 / 1,000 cleaned items
Go to Apify Store
spruce_the_data: messy HTML and text to clean JSON
Turns messy scraped text or HTML into clean JSON that matches your schema.
spruce_the_data: messy HTML and text to clean JSON
Pricing
from $10.00 / 1,000 cleaned items
Turns messy scraped text or HTML into clean JSON that matches your schema.
You can access the spruce_the_data: messy HTML and text to clean JSON programmatically from your own applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in API & Integrations in Apify Console.
1import { ApifyClient } from 'apify-client';2
3// Initialize the ApifyClient with your Apify API token4// Replace the '<YOUR_API_TOKEN>' with your token5const client = new ApifyClient({6 token: '<YOUR_API_TOKEN>',7});8
9// Prepare Actor input10const input = {11 "texts": [12 "<h1> Stellar Gooseneck Kettle 1.0L </h1><span class=\"price\">$49.99</span> In stock"13 ],14 "outputSchema": {15 "type": "object",16 "properties": {17 "name": {18 "type": "string"19 },20 "price": {21 "type": [22 "number",23 "null"24 ]25 },26 "currency": {27 "type": [28 "string",29 "null"30 ],31 "description": "ISO 4217 code, e.g. USD"32 },33 "in_stock": {34 "type": [35 "boolean",36 "null"37 ]38 }39 },40 "required": [41 "name",42 "price",43 "currency",44 "in_stock"45 ]46 }47};48
49// Run the Actor and wait for it to finish50const run = await client.actor("sprucethedata/clean-json").call(input);51
52// Fetch and print Actor results from the run's dataset (if any)53console.log('Results from dataset');54console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);55const { items } = await client.dataset(run.defaultDatasetId).listItems();56items.forEach((item) => {57 console.dir(item);58});59
60// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docsThe Apify API client for JavaScript is the official library that allows you to use spruce_the_data: messy HTML and text to clean JSON API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.
Install the apify-client
$npm install apify-clientOther API clients include: