Home > OS >  What is a proper AWSJSON?
What is a proper AWSJSON?

Time:11-13

I have used this

var jsonData = {"hello": 20};

while passing this to graphql query

products:jsonData

it fails with this error

Validation error of type WrongType: argument 'input.products' with value 'StringValue{value='{hello: 20}'}' is not a valid 'AWSJ

ps help

CodePudding user response:

AWSJSON is a JSON string.

var jsonData = '{"hello":20}'

CodePudding user response:

final jsonEncoder = JsonEncoder();
const JsonEncoder encoder = JsonEncoder.withIndent('  ');
String sta = jsonEncode(encoder.convert(_products));

then pass

products: $sta

This worked for me

  • Related