0

I am really struggling with an assignment. Long story short, I have to create a card game, where the 64 cards are given in a JSON file. Players lay cards down to beat other players based on various criteria. I am having trouble parsing the file into something I can use. The JSON card file essentially looks like this (I'll show two cards), with 62 more cards:

{"cards":[{"fileName":"Slide01.jpg","imageName":"Slide01","title":"Quartz","chemistry":"SiO_2","classification":"tectosilicate","crystal_system":"hexagonal","occurrence":["igneous","metamorphic","sedimentary"],"hardness":"7","specific_gravity":"2.65","cleavage":"poor/none","crustal_abundance":"high","economic_value":"moderate"},{"fileName":"Slide02.jpg","imageName":"Slide02","title":"Plagioclase","chemistry":"Na Al Si_3 O_8 - Ca Al_2 Si_2 O_8","classification":"tectosilicate","crystal_system":"triclinic","occurrence":["igneous","metamorphic","sedimentary"],"hardness":"6-6.5","specific_gravity":"2.6-2.8","cleavage":"1 perfect, 1 good","crustal_abundance":"very high","economic_value":"moderate"}, ...}

I need to parse this in order to manipulate the different elements of the card (title, chemistry, classification, etc.) I have tried a few things and get absolutely nothing. Any help or hints would be most appreciated!

dh97
  • 1
  • 1
    Maybe if you indicate the language you are using for your development will help people in order to solve the question. For example for parsing in Java you could follow this example: http://theoryapp.com/parse-json-in-java/ or this other StackOverflow question: https://stackoverflow.com/questions/2591098/how-to-parse-json-in-java – Dez Sep 01 '16 at 11:47
  • To parse in Javascript: http://stackoverflow.com/questions/9991805/javascript-how-to-parse-json-array – User_Targaryen Sep 01 '16 at 11:50
  • Thanks for the tip! I am using Java, and I did take a look at that other answer and I still couldn't get it to do anything useful with my file. – dh97 Sep 02 '16 at 16:06

0 Answers0