drkbcn / json_listings_feed
Transform legacy Amazon XML feeds into the new JSON_LISTINGS_FEED format for SP-API.
Requires
- php: >=8.1
- jlevers/selling-partner-api: ^5.10
- symfony/dotenv: ^7.3
This package is auto-updated.
Last update: 2025-07-26 10:22:47 UTC
README
Transform your legacy Amazon XML feeds into the new JSON_LISTINGS_FEED format for SP-API. Free and Open Source!
๐ Why this project?
Amazon is deprecating its legacy XML and flat-file feeds and migrating to the new JSON_LISTINGS_FEED format for SP-API. While the excellent jlevers/selling-partner-api library provides comprehensive SP-API access (and is completely free!), the author also created a separate commercial feed transformer tool by Highside Labs that charges $299-$899 per feed type to handle this migration.
At @labelgrupnetworks, we faced the same situation and needed a cost-effective solution, so we built this free and open-source transformer for the community.
โจ Features
- ๐ Transform legacy Amazon XML to JSON_LISTINGS_FEED
- ๐ Supports inventory, pricing, product, image, and relationship feeds
- ๐งฉ Direct integration with jlevers/selling-partner-api
- ๐ 100% Open Source and free
- ๐ท๏ธ Designed for migrations and automations
- ๐ ๏ธ Easy to use, no commercial dependencies
- ๐ฆ Uses PATCH operations for optimal performance
๐ฆ Installation
git clone https://github.com/drkbcn/json_listings_feed.git
cd json_listings_feed
composer install
Copy .env.example
to .env
and configure your Amazon SP-API credentials.
๐ Quick Usage
Basic Transformation
use Labelgrup\AmazonTransformer\Transformer; $transformer = new Transformer($sellerId, $marketplaceId); $json = $transformer->transformXmlToJson($xmlContent); echo $json;
Complete Workflow (Inventory Update)
use Labelgrup\AmazonTransformer\{AmazonXMLFunctions, Transformer}; use SellingPartnerApi\{FeedType, Api\FeedsV20210630Api}; // Generate XML (for compatibility with existing systems) $xmlBuilder = new AmazonXMLFunctions($sellerId); $messages = [$xmlBuilder->getQtyMessage($sku, $newQuantity)]; $xmlContent = $xmlBuilder->buildXmlInventoryData($messages); // Transform to JSON $transformer = new Transformer($sellerId, $marketplaceId); $jsonOutput = $transformer->transformXmlToJson($xmlContent); // Send to Amazon $feedsApi = new FeedsV20210630Api($config); // ... (see examples for complete implementation)
๐งโ๐ป Migration Examples
Inventory Update
Old XML Format:
<AmazonEnvelope> <Header> <DocumentVersion>1.01</DocumentVersion> <MerchantIdentifier>A3UM3SGRVK155I</MerchantIdentifier> </Header> <MessageType>Inventory</MessageType> <Message> <MessageID>1</MessageID> <OperationType>Update</OperationType> <Inventory> <SKU>B0182SJFQQ</SKU> <Quantity>5</Quantity> </Inventory> </Message> </AmazonEnvelope>
New JSON Format (Generated):
{ "header": { "sellerId": "A3UM3SGRVK155I", "version": "2.0", "issueLocale": "es_ES" }, "messages": [ { "messageId": 1, "sku": "B0182SJFQQ", "operationType": "PATCH", "productType": "PRODUCT", "patches": [ { "op": "replace", "path": "/attributes/fulfillment_availability", "value": [ { "fulfillment_channel_code": "DEFAULT", "quantity": 5 } ] } ] } ] }
Price Update
Old XML Format:
<AmazonEnvelope> <MessageType>Price</MessageType> <Message> <MessageID>1</MessageID> <OperationType>Update</OperationType> <Price> <SKU>RS-7IGC-AFXK</SKU> <StandardPrice currency="EUR">18.78</StandardPrice> </Price> </Message> </AmazonEnvelope>
New JSON Format (Generated):
{ "messages": [ { "messageId": 1, "sku": "RS-7IGC-AFXK", "operationType": "PATCH", "productType": "PRODUCT", "patches": [ { "op": "replace", "path": "/attributes/purchasable_offer", "value": [ { "audience": "ALL", "currency": "EUR", "our_price": [ { "schedule": [ { "value_with_tax": 18.78 } ] } ] } ] } ] } ] }
๐งช Examples & Testing
Available Examples
examples/inventory.php
โ Complete inventory update workflowexamples/pricing.php
โ Complete pricing update workflow
Utility Scripts
check_feed.php
โ Monitor feed processing statuscheck_product.php
โ Get product information and pricing details
Running Examples
# Update inventory php examples/inventory.php # Update pricing php examples/pricing.php # Check feed status php check_feed.php [feedId] [--detailed] # Get product info php check_product.php [SKU]
๐ง Supported Feed Types
- โ POST_INVENTORY_AVAILABILITY_DATA - Inventory quantity updates
- โ POST_PRODUCT_PRICING_DATA - Product pricing updates
- โ POST_PRODUCT_DATA - Product information updates
- โ POST_PRODUCT_IMAGE_DATA - Product image updates
- โ POST_PRODUCT_RELATIONSHIP_DATA - Variation relationships
๐ข About Us
Created with โค๏ธ by @drkbcn at Labelgrup Networks.
- ๐ผ Company: labelgrup.com
- โ Support: Ko-fi
- ๐ง Contact: hello@labelgrup.com
๐ค Contributing
Did this project save you money? Consider:
- โญ Starring this repository
- ๐ Reporting issues or requesting features
- ๐ Contributing code improvements
- โ Buying me a coffee
๐ License
MIT License - Free to use, modify, and distribute!
๏ฟฝ Credits
- Inspiration: Amazon Sellers community facing migration challenges
- Built on: jlevers/selling-partner-api (the excellent free SP-API library)
- Alternative to: Highside Labs' commercial Feed Transformer (which charges $299-$899 per feed type)
๐ Resources
We hope this helps you migrate your Amazon integrations without breaking the bank! ๐ฐ