Overview
The Usfm-Json Parser node is designed to convert between USFM (Unified Standard Format Markers, commonly used for biblical texts) and JSON formats. It automatically detects whether the input is in USFM or JSON format and performs the appropriate conversion:
- If the input is valid JSON, it converts it to USFM.
- If the input is not valid JSON (assumed to be USFM), it converts it to JSON.
This node is useful in workflows where you need to interchange data between USFM and JSON representations, such as integrating with Bible translation tools, digital publishing pipelines, or content management systems that use these formats.
Example scenarios:
- Importing USFM files into a system that requires JSON.
- Exporting structured JSON data back into USFM for use with traditional tools.
Properties
| Name | Type | Meaning |
|---|---|---|
| Usfm or Json | String | Input USFM or JSON here. The node will auto-detect the format and convert accordingly. |
Output
The output contains a json field with the following structure:
{
"result": "<Converted USFM or JSON string>"
}
- If the input was JSON,
resultwill contain the corresponding USFM string. - If the input was USFM,
resultwill contain the corresponding JSON string.
Dependencies
- usfm-js: This external library is required for parsing and converting between USFM and JSON formats.
- No API keys or special n8n configurations are required.
Troubleshooting
Common issues:
- Invalid Input Format:
If the input is neither valid JSON nor valid USFM, the node may throw an error during conversion. - Error Handling:
If an error occurs and "Continue On Fail" is enabled, the node will add anerrorproperty to the output item. Otherwise, the workflow will stop, and an error message will be shown.
Common error messages:
"Unexpected token ... in JSON at position ...":
This means the input could not be parsed as JSON. Ensure your input is valid JSON if you intend to convert from JSON to USFM."Cannot read property ... of undefined"or similar errors fromusfm-js:
This indicates the input is not valid USFM or JSON. Double-check your input format.