The "Invalid JSON" error in the Web Element Extractor means the JSON input for your Phantom is incomplete or invalid, usually because one or more required setup fields are missing. The fix is to open your Phantom's setup and confirm that the Link, Selector, Label, and csvName fields are all filled in correctly, then relaunch.
Why you’re seeing this
This error happens when the JSON input for your Phantom is incomplete or invalid.
It usually means one or more required fields in the setup are missing or incorrect. Without these values, the Phantom can’t structure the data properly and fails.
How to fix it
Check your required fields
Open your Phantom's setup and make sure each of the following fields is filled in:
- Link: The website URL to extract
- Selector: The element selector on the page that identifies the information to extract
- Label: The column name under which the extracted data will appear in the results file
- csvName: The name of the output file
Relaunch your Phantom
Once all fields are filled in, save your changes and relaunch the Phantom. The JSON input will be rebuilt from the updated fields and the error should no longer appear.
Frequently asked questions
What does the "Invalid JSON" error in the Web Element Extractor mean?
It means the Phantom couldn't build valid JSON from your setup, usually because a required field is missing or contains an incorrect value. The Phantom needs complete input to structure the extracted data into a results file.
Which fields are required in the Web Element Extractor setup?
Four fields are required: Link (the URL to extract from), Selector (the element on the page to extract), Label (the column name in the results file), and csvName (the name of the output file).
What is a selector and how do I find it?
A selector is a string that identifies a specific element on a web page, for example a CSS class or an ID. You can find it by right-clicking the element in your browser, choosing Inspect, and copying the selector from the developer tools panel.
Why does my Phantom need a csvName?
The csvName tells the Phantom what to name the output file. Without it, the Phantom has no destination for the extracted data and the JSON input is considered incomplete.
Can I use the Web Element Extractor without a Label for every field?
No. The Label is required so each extracted value has a column name in the results file. Without labels, the output structure is invalid and the Phantom returns the "Invalid JSON" error.
If the error keeps showing up
If you've completed all fields and the error still appears, get in touch with our Customer Care Team. Please include:
- The Phantom name and a link to the run
- The exact error message from the console
- A screenshot of your Phantom's setup showing the Link, Selector, Label, and csvName fields
- The URL or element you're trying to extract