0

I am having a JSON file with multiple and multi-level data. Now I want to store this data into MySQL database. I searched many links but didn't suit to my data and none of it helped me.

My JSON data: http://fiddle.jshell.net/4QNYk/

I am new to JSON and Java. Please help me out.

5
  • 2
    I dont think there's anything wrong with storing it as text? Commented May 30, 2014 at 9:16
  • Take data type as text and store whole response in database Commented May 30, 2014 at 9:17
  • Use Postgres :) It has json data type and is able to both store and query json data effectively. wiki.postgresql.org/wiki/… (more effectively than MongoDB). Commented May 30, 2014 at 9:18
  • 1
    if u just want to store as it is and retrieve JSON text as it is on query then datatype of TEXT will do !! if u want to query on this JSON data in future then use MongoDB Database, Commented May 30, 2014 at 9:19
  • Could you please help me how to store it as a text in database. Commented May 30, 2014 at 9:28

1 Answer 1

2

Depending on what you want to do later with the JSON, storing it as a normal text seems to be the best idea on MySQL at the moment. Other DBMS like PostgreSQL are having some datatype for JSON -- but assuming you having you application magic at Java-side and not wanting to start fuzzying around with the JSON on database layer, text is totally fine.

Of course, if you want to search inside the JSON it's maybe not the best way of storing them. But as mentioned in the comments, there are other DBMS are better choice.

Sign up to request clarification or add additional context in comments.

2 Comments

hi @frlan Thanks for the quick response. Can you please help me how to store it as a normal text in MySQL.
No clue about Java at this point. Create a text field on you MySQL and ensure you JSON object is transfered to varchar/string/* before sending to database.

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.