JSON to RSS
FeedCraft includes a JSON to RSS tool that allows you to fetch data from JSON APIs, extract fields with jq, and optionally post-process them with templates before generating an RSS feed.
Overview
Section titled “Overview”The JSON to RSS tool helps you:
- Fetch JSON data from an API endpoint (supporting custom headers and methods).
- Parse the JSON structure using
jqsyntax, then optionally use templates to build the final RSS fields. - Metadata Define feed details like title and description.
- Save the configuration as a Custom Recipe directly.
How to use
Section titled “How to use”Navigate to Worktable > Generate Feed Sources > API to RSS in the admin dashboard.
Step 1: Request Configuration
Section titled “Step 1: Request Configuration”You need to define how to fetch the JSON data.
- Import from cURL: You can paste a
curlcommand to automatically populate the URL, method, headers, and body. This is useful if you copy the request from your browser’s Developer Tools. - Method: Select
GETorPOST. - URL: The API endpoint URL.
- Headers: Add any necessary headers (e.g.,
Authorization,Content-Type). - Request Body: For POST requests, provide the JSON body.
Click Fetch and Next to retrieve the data.
Step 2: Parsing Rules
Section titled “Step 2: Parsing Rules”Once the JSON is fetched, you will see the raw response in the left panel (visualized as a tree). You can now define selectors to extract feed items.
The tool uses jq syntax for querying JSON, and it can optionally apply templates to the extracted values. For common cases, use ${field_name} to read fields from the current item; for functions, extracted fields, or more complex logic, use Go templates.
- List Selector (Items Iterator): The path to the array of items.
- Tip: You can click on a node in the tree view to auto-fill selectors.
- Title Selector: The path to the item’s title relative to the item object.
- Title Template: Optional. Post-process the extracted title, for example
{{ .Fields.Title | trimSpace }}. - Link Selector: The path to the item’s URL.
- Link Template: Optional. Useful when the API only returns an ID, for example
https://some-website.com/article/${article_id}. - Date Selector: (Optional) Path to the publication date.
- Content Selector: (Optional) Path to the full content or summary.
Using Templates (Optional)
Section titled “Using Templates (Optional)”Templates support two forms:
- Short variables:
${article_id}reads thearticle_idfield from the current item;${author.name}reads a nested field. - Go templates: Use Go Templates to further process extracted values.
Available Variables:
.Fields: The parsed field values (e.g.,.Fields.Title,.Fields.Link,.Fields.Date,.Fields.Description)..Item: The raw JSON item object (e.g.,.Item.id,.Item.author.name).
Built-in Functions:
trimSpace: Removes leading and trailing whitespace.trim: Removes specified leading and trailing characters.default: Provides a fallback value if the field is empty.
Examples:
- Clean up whitespace in title:
{{ .Fields.Title | trimSpace }} - Build absolute URLs:
https://example.com/article/${article_id} - Read nested fields:
by ${author.name} - Remove specific prefixes:
{{ .Fields.Description | trim "Prefix: " }} - Fallback values:
{{ default .Fields.Description "No summary available" }}
Click Run Preview to verify your selectors, then click Next Step.
Step 3: Feed Metadata
Section titled “Step 3: Feed Metadata”Configure the RSS feed details:
- Feed Title: The name of your new feed.
- Description: A short description.
- Site Link: The URL of the original website.
- Author: (Optional) Author details.
Step 4: Save Recipe
Section titled “Step 4: Save Recipe”Review your configuration and save it as a permanent recipe.
- Recipe Unique ID: A unique identifier for this feed configuration (e.g.,
my-custom-api-feed).- Auto-Fill: This field is automatically populated from the feed title.
- Format: Only lowercase letters, numbers, and hyphens (
[a-z0-9-]) are allowed. - Refresh: You can manually regenerate the ID from the title using the refresh button.
- Internal Description: Notes for yourself about this recipe.
Click Confirm and Save. The tool will automatically create a new Custom Recipe with your configuration, which you can manage in the Custom Recipes dashboard.
FeedCraft v3.2.0