title: How to send JSON array through graphQL and AWS AppSync to add data to Dynamo Table?
body: <p>What I'm trying to do is to send data from a React Native app through AppSync so that I can update a user's data on a dynamo table. I can perform all of my CRUD operations, just not a list of data. When I try, I get an error that what I'm sending isn't a valid JSON. However, my input passes as valid JSON when I put it through a JSON linter.</p>
  
  <p>To try and solve this problem, I've changed my input flow to the simplest possible process. Originally I was pulling my JSON from a parsed JSON string that was locally cached. I thought that perhaps there was an issue with the JSON.parse(obj) function. That didn't hold up to reason. So I moved all of my input out of a JS object and into a JSON that isn't stored in a variable beforehand but is directly passed to the API I'm using (<a href="https://aws-amplify.github.io/docs/js/api" rel="noreferrer">https://aws-amplify.github.io/docs/js/api</a>).</p>
  
  <p>After this didn't work, I thought that maybe my GraphQL Schema was wrong for the object type I was sending, but didn't find anything amiss. </p>
  
  <p>My schema in AppSync using GraphQL is defined as follow:</p>
  
  <pre><code>input CreateUserInput {
    email: String!
    data: AWSJSON
  }
  </code></pre>
  
  <p>The request I'm sending is as follows:</p>
  
  <pre><code>const dbReturn = await API.graphql(graphqlOperation(
    mutations.createUser, {
      input: {
        "email": "fake.email@atdot.com",
        "data": [{
          "num": 34,
        }]
      }
    }
  ));
  </code></pre>
  
  <p>The error message says:</p>
  
  <blockquote>
    <p>"Variable 'data' has an invalid value. Unable to parse [{num=34}] as
    valid JSON."</p>
  </blockquote>
  
  <p>What confuses me is that <code>"[{num=34}]"</code> isn't the input I'm giving it. I'm sending it <code>"[{"num": 34}]"</code> which is valid JSON. I would expect it to be able to parse my input and send the data to my dynamo table seeing as the JSON input is valid. </p>
  
  <p>Anybody have any ideas what I can do to get past this? Thank you for the help!</p>