24

Not sure what I'm getting wrong with my json format. Just trying to test out aws cli and run aws s3api list-objects --cli-input-json <json_file>.json --profile <profile_name> where <my_json> is below but getting:

Error parsing parameter 'cli-input-json': Invalid JSON: Expecting value: line 1 column 1 (char 0)
JSON received: <my_json.json>

{"Bucket": "<bucket_name>","Delimiter": "","EncodingType": "","Marker": "","MaxKeys": 0,"Prefix": "<prefix_name>"}
3

2 Answers 2

61

Instead of :

my_json.json

You have to use file:// before the json name :

file://my_json.json
Sign up to request clarification or add additional context in comments.

2 Comments

I'm running into this too, but I'm using file:// syntax.
Given the constraint above, I had to navigate to the exact folder on my local and then call --cli-input-json for AWS SES. Not sure why you can't just put a *nix path in there.
9

In my case, I think it was needing ASCII encoding (unicode being the default)... added -Encoding ASCII -NoNewline to my Out-File and it worked.

2 Comments

In particular I needed to generate my json file with via aws {cmd} --generate-cli-skeleton | Out-File -encoding ascii aws-service.json When I simply redirected the output to a file the cli would not accept that file.
Thanks. This is the only clue that works for me. I have to convert my json file to UTF-8 (with Notepad++). I am using AWS CLI v2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.