0

I have saved my JSONs in a database and I want to get specific objects from every entry. I'll show it:

[
   {
      "Messungen":[
         {
            "car":"no Car choosed",
            "g":0.2,
            "time":"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]",
            "max":66,
            "secondText":"0 - 200 km\/h",
            "speed":"[63, 61, 63, 62, 63, 64, 65, 65, 66, 66, 66, 64, 63, 63]",
            "tosecond":"\/",
            "to100":"\/",
            "way":209,
            "avg":63
         }
      ]
   },
   {
      "Messungen":[
         {
            "car":"no Car choosed",
            "g":0.2,
            "time":"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44]",
            "max":70,
            "secondText":"0 - 200 km\/h",
            "speed":"[59, 61, 61, 61, 62, 60, 61, 62, 61, 62, 63, 63, 64, 64, 63, 63, 64, 65, 65, 65, 65, 65, 66, 66, 67, 69, 69, 67, 67, 67, 67, 67, 68, 68, 69, 70, 70, 69, 69, 69, 69, 69, 68, 66, 66]",
            "tosecond":"\/",
            "to100":"\/",
            "way":808,
            "avg":65
         }
      ]
   }
]

I want to get the way and the car from the Array Messungen as a List or Array. Is that possible or should I make two new entries in the database with these two types?

Thanks :)

3
  • Your question isn't very clear. Are you saving whole JSON structures as-is in your database, or is that the output of some script which reads the database and converts it to JSON? The first option would be quite useless IMHO. Also, you're supposed to show what you have tried and point out the actually issues you encountered. Commented Jul 8, 2014 at 17:30
  • Ok sorry.. I didn't want to create so many rows in the database so I've put them in a JSON String. As a result every entry has an ID, a JSON String and a timestamp. Now I want to create a ListView with the row car and way. But I don't know how to get only the way and the car from so many JSON Strings.. Do you understand ? Commented Jul 8, 2014 at 17:42
  • In what language do you want it? Commented Jul 8, 2014 at 17:45

1 Answer 1

1

Databases are designed to be good at managing many, many rows. Use the power of the database. Create a table called "Messung" and make each observation (car, g, way, u.s.w) a column in the table.

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

2 Comments

Actually, time and speed would probably be better as separate tables joined with the first one.
You're right.. I think I'll seperate the two columns ;)

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.