-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
** Which Category is your question related to? **
So i want to save a json like: {"x": 1, "json": {"y": 2}}
** What AWS Services are you utilizing? **
Amplify, AppSync, GraphQL, DynamoDB
** Provide additional details e.g. code snippets **
my Solution:
`
const answerinput = {
answerUserId: "a38c6b6f-bd32-47be-a922-1043c5b0c9f8",
exam_id: "labyrinth",
cycle: 1,
score: 2200,
rating: 5,
aivy_output: JSON.stringify({
level_1: { time_needed_in_ms: 13675, retries: 2, succes: true, id: 0 },
level_2: { time_needed_in_ms: 15674, retries: 3, succes: true, id: 2 },
level_3: { time_needed_in_ms: 11575, retries: 4, succes: true, id: 0 },
view: { width: 440, height: 621 }
})
};
const answer = await API.graphql(
graphqlOperation(mutations.createAnswer, {
input: answerinput
})
);
console.log(JSON.parse(answer.data.createAnswer.aivy_output));
`
So you can see, that i first have to stringify my aivy_output field, and than JSON.parse.
is there a better way?