How to store and fetch nested json data from dynamodb in java

0 votes

I want to maintain a book library. At a time i want to fetch the records to find out books available in library based on **available** flag.
Sample json to maintain book details.

```
{
    "totalNumberOfBooks":"30",
    "booksTypes":[
        {
        "language":"english",
        "books":[
            {
                "bookID":"1223",
                "booName":"XYZ",
                "available":false
            },            {
                "bookID":"2223",
                "booName":"ABC",
                "available":true
            }
        ]

    },{
        "language":"Spanish",
        "books":[
            {
                "bookID":"67666",
                "booName":"DEF",
                "available":false
            },            {
                "bookID":"56567",
                "booName":"GHEE",
                "available":true
            }
        ]

    }
    ]

}
```

Please help me to represent this in dynamodb. I want to store and fetch record in java language.

I tried to use dynamDBDocument for the internal json, ans tried to use filter expression as books.available, but i am not able to filter the records based on this.
```
{
                "bookID":"1223",
                "booName":"XYZ",
                "available":false
}
```
Sep 7, 2020 in Java by saswat
• 120 points

edited Sep 7, 2020 by Gitika 4,484 views

Hi, @Saswat,

Are you facing any error executing your code? What is wrong happening with the code or do you want an exact customized code regarding your query?

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java

0 votes
1 answer

how to read csv file form sftp connection and store into string object in java code and convert into json.....post it using rest api

Hey, @Pooja, Before starting with anything you should ...READ MORE

answered May 13, 2020 in Java by Roshni
• 10,520 points
3,467 views
0 votes
1 answer

In Java, how to find out the min/max values from array of primitive data types?

import java.util.Arrays; import java.util.Collections; import org.apache.commons.lang.ArrayUtils; public class MinMaxValue { ...READ MORE

answered Jun 12, 2018 in Java by Daisy
• 8,120 points
1,396 views
0 votes
1 answer

How to convert or cast hashmap to JSON object in Java, and again convert JSON object to JSON string?

You can use: new JSONObject(map); READ MORE

answered Jun 27, 2018 in Java by Akrati
• 3,190 points
6,552 views
0 votes
2 answers

How can I create File and write data in it using Java?

import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class WriteFiles{ ...READ MORE

answered Jul 26, 2018 in Java by samarth295
• 2,220 points
2,528 views
0 votes
3 answers

How to parse JSON in Java

import org.json.*; JSONObject obj = new JSONObject(" .... ...READ MORE

answered Aug 20, 2018 in Java by Daisy
• 8,120 points
3,687 views
+16 votes
25 answers

How can I convert String to JSON object in Java?

Hi @Daisy You can use Google gson  for more ...READ MORE

answered Feb 7, 2019 in Java by Suresh
• 720 points
250,409 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP