Architecting for subscriptions - example code error: SyntaxError: Unexpected token s in JSON at position 0

I followed the instructions in:

Determining Service Entitlement on the Server
https://developer.apple.com/documentation/storekit/in-app_purchase/subscriptions_and_offers/determining_service_entitlement_on_the_server

Running the following:
curl -XPOST -H "Content-type: application/json" -d 'simulateExamples/flatJsonExample.json' 'localhost:3000/simulate'

got the error:

node ./bin/www
POST /simulate 400 8.436 ms - 1276
SyntaxError: Unexpected token s in JSON at position 0

I validated flatJsonExample.json with lint and it was OK.

Replies

Add the @ sign to indicate the contents of a file. It's expecting JSON data in place of <FLAT JSON DATA>.

Run this:
curl -XPOST -H "Content-type: application/json" -d '@simulateExamples/flatJsonExample.json' 'localhost:3000/simulate'