Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 130
  • Last Modified:

Create json object from json string

I have the following data but not sure how to get this for use in javascript. currently its in a textfile but maybe I can embed this into the code as a static object.

{"Tonic":"C", "ScaleType":"Whole Tone"},
{"Tonic":"C", "ScaleType":"Minor Blues"},
{"Tonic":"C", "ScaleType":"Minor Pentatonic"},
{"Tonic":"C", "ScaleType":"Major Pentatonic"},
{"Tonic":"C", "ScaleType":"Harmonic Minor"},
{"Tonic":"C", "ScaleType":"Melodic Minor"},
{"Tonic":"C", "ScaleType":"Super Locrian"},
{"Tonic":"C", "ScaleType":"Bhairav"},
{"Tonic":"C", "ScaleType":"Hungarian Minor"},
{"Tonic":"C", "ScaleType":"Minor Gypsy"},
{"Tonic":"C", "ScaleType":"Hirojoshi"},
{"Tonic":"C", "ScaleType":"In-Sen"},
{"Tonic":"C", "ScaleType":"Iwato"},
{"Tonic":"C", "ScaleType":"Kumoi"},
{"Tonic":"C", "ScaleType":"Pelog"},
{"Tonic":"C", "ScaleType":"Spanish"},
{"Tonic":"D", "ScaleType":"Major"},
{"Tonic":"D", "ScaleType":"Minor"},
{"Tonic":"D", "ScaleType":"Dorian"},
{"Tonic":"D", "ScaleType":"Mixolydian"},
{"Tonic":"D", "ScaleType":"Lydian"},
{"Tonic":"D", "ScaleType":"Phrygian"},
{"Tonic":"D", "ScaleType":"Locrian"},
{"Tonic":"D", "ScaleType":"Diminished"},
{"Tonic":"D", "ScaleType":"Whole-half"},
{"Tonic":"D", "ScaleType":"Whole Tone"},
{"Tonic":"D", "ScaleType":"Minor Blues"},
{"Tonic":"D", "ScaleType":"Minor Pentatonic"},
{"Tonic":"D", "ScaleType":"Major Pentatonic"},
{"Tonic":"D", "ScaleType":"Harmonic Minor"},
{"Tonic":"D", "ScaleType":"Melodic Minor"},
{"Tonic":"D", "ScaleType":"Super Locrian"},
{"Tonic":"D", "ScaleType":"Bhairav"},
{"Tonic":"D", "ScaleType":"Hungarian Minor"},
{"Tonic":"D", "ScaleType":"Minor Gypsy"},
{"Tonic":"D", "ScaleType":"Hirojoshi"},
{"Tonic":"D", "ScaleType":"In-Sen"},
{"Tonic":"D", "ScaleType":"Iwato"},
{"Tonic":"D", "ScaleType":"Kumoi"},
{"Tonic":"D", "ScaleType":"Pelog"},
{"Tonic":"D", "ScaleType":"Spanish"},
{"Tonic":"E", "ScaleType":"Major"},
{"Tonic":"E", "ScaleType":"Minor"},
{"Tonic":"E", "ScaleType":"Dorian"},
{"Tonic":"E", "ScaleType":"Mixolydian"},
{"Tonic":"E", "ScaleType":"Lydian"},
{"Tonic":"E", "ScaleType":"Phrygian"},
{"Tonic":"E", "ScaleType":"Locrian"},
{"Tonic":"E", "ScaleType":"Diminished"},
{"Tonic":"E", "ScaleType":"Whole-half"},
{"Tonic":"E", "ScaleType":"Whole Tone"},
{"Tonic":"E", "ScaleType":"Minor Blues"},
{"Tonic":"E", "ScaleType":"Minor Pentatonic"},
{"Tonic":"E", "ScaleType":"Major Pentatonic"},
{"Tonic":"E", "ScaleType":"Harmonic Minor"},
{"Tonic":"E", "ScaleType":"Melodic Minor"},
{"Tonic":"E", "ScaleType":"Super Locrian"},
{"Tonic":"E", "ScaleType":"Bhairav"},
{"Tonic":"E", "ScaleType":"Hungarian Minor"},
{"Tonic":"E", "ScaleType":"Minor Gypsy"},
{"Tonic":"E", "ScaleType":"Hirojoshi"},
{"Tonic":"E", "ScaleType":"In-Sen"},
{"Tonic":"E", "ScaleType":"Iwato"},
{"Tonic":"E", "ScaleType":"Kumoi"},
{"Tonic":"E", "ScaleType":"Pelog"},
{"Tonic":"E", "ScaleType":"Spanish"},
{"Tonic":"A", "ScaleType":"Major"},
{"Tonic":"A", "ScaleType":"Minor"},
{"Tonic":"A", "ScaleType":"Dorian"},
{"Tonic":"A", "ScaleType":"Mixolydian"},
{"Tonic":"A", "ScaleType":"Lydian"},
{"Tonic":"A", "ScaleType":"Phrygian"},
{"Tonic":"A", "ScaleType":"Locrian"},
{"Tonic":"A", "ScaleType":"Diminished"},
{"Tonic":"A", "ScaleType":"Whole-half"},
{"Tonic":"A", "ScaleType":"Whole Tone"},
{"Tonic":"A", "ScaleType":"Minor Blues"},
{"Tonic":"A", "ScaleType":"Minor Pentatonic"},
{"Tonic":"A", "ScaleType":"Major Pentatonic"},
{"Tonic":"A", "ScaleType":"Harmonic Minor"},
{"Tonic":"A", "ScaleType":"Melodic Minor"},
{"Tonic":"A", "ScaleType":"Super Locrian"},
{"Tonic":"A", "ScaleType":"Bhairav"},
{"Tonic":"A", "ScaleType":"Hungarian Minor"},
{"Tonic":"A", "ScaleType":"Minor Gypsy"},
{"Tonic":"A", "ScaleType":"Hirojoshi"},
{"Tonic":"A", "ScaleType":"In-Sen"},
{"Tonic":"A", "ScaleType":"Iwato"},
{"Tonic":"A", "ScaleType":"Kumoi"},
{"Tonic":"A", "ScaleType":"Pelog"},
{"Tonic":"A", "ScaleType":"Spanish"},
{"Tonic":"B", "ScaleType":"Major"},
{"Tonic":"B", "ScaleType":"Minor"},
{"Tonic":"B", "ScaleType":"Dorian"},
{"Tonic":"B", "ScaleType":"Mixolydian"},
{"Tonic":"B", "ScaleType":"Lydian"},
{"Tonic":"B", "ScaleType":"Phrygian"},
{"Tonic":"B", "ScaleType":"Locrian"},
{"Tonic":"B", "ScaleType":"Diminished"},
{"Tonic":"B", "ScaleType":"Whole-half"},
{"Tonic":"B", "ScaleType":"Whole Tone"},
{"Tonic":"B", "ScaleType":"Minor Blues"},
{"Tonic":"B", "ScaleType":"Minor Pentatonic"},
{"Tonic":"B", "ScaleType":"Major Pentatonic"},
{"Tonic":"B", "ScaleType":"Harmonic Minor"},
{"Tonic":"B", "ScaleType":"Melodic Minor"},
{"Tonic":"B", "ScaleType":"Super Locrian"},
{"Tonic":"B", "ScaleType":"Bhairav"},
{"Tonic":"B", "ScaleType":"Hungarian Minor"},
{"Tonic":"B", "ScaleType":"Minor Gypsy"},
{"Tonic":"B", "ScaleType":"Hirojoshi"},
{"Tonic":"B", "ScaleType":"In-Sen"},
{"Tonic":"B", "ScaleType":"Iwato"},
{"Tonic":"B", "ScaleType":"Kumoi"},
{"Tonic":"B", "ScaleType":"Pelog"},
{"Tonic":"B", "ScaleType":"Spanish"},
{"Tonic":"G", "ScaleType":"Major"},
{"Tonic":"G", "ScaleType":"Minor"},
{"Tonic":"G", "ScaleType":"Dorian"},
{"Tonic":"G", "ScaleType":"Mixolydian"},
{"Tonic":"G", "ScaleType":"Lydian"},
{"Tonic":"G", "ScaleType":"Phrygian"},
{"Tonic":"G", "ScaleType":"Locrian"},
{"Tonic":"G", "ScaleType":"Diminished"},
{"Tonic":"G", "ScaleType":"Whole-half"},
{"Tonic":"G", "ScaleType":"Whole Tone"},
{"Tonic":"G", "ScaleType":"Minor Blues"},
{"Tonic":"G", "ScaleType":"Minor Pentatonic"},
{"Tonic":"G", "ScaleType":"Major Pentatonic"},
{"Tonic":"G", "ScaleType":"Harmonic Minor"},
{"Tonic":"G", "ScaleType":"Melodic Minor"},
{"Tonic":"G", "ScaleType":"Super Locrian"},
{"Tonic":"G", "ScaleType":"Bhairav"},
{"Tonic":"G", "ScaleType":"Hungarian Minor"},
{"Tonic":"G", "ScaleType":"Minor Gypsy"},
{"Tonic":"G", "ScaleType":"Hirojoshi"},
{"Tonic":"G", "ScaleType":"In-Sen"},
{"Tonic":"G", "ScaleType":"Iwato"},
{"Tonic":"G", "ScaleType":"Kumoi"},
{"Tonic":"G", "ScaleType":"Pelog"},
{"Tonic":"G", "ScaleType":"Spanish"},
{"Tonic":"F", "ScaleType":"Major"},
{"Tonic":"F", "ScaleType":"Minor"},
{"Tonic":"F", "ScaleType":"Dorian"},
{"Tonic":"F", "ScaleType":"Mixolydian"},
{"Tonic":"F", "ScaleType":"Lydian"},
{"Tonic":"F", "ScaleType":"Phrygian"},
{"Tonic":"F", "ScaleType":"Locrian"},
{"Tonic":"F", "ScaleType":"Diminished"},
{"Tonic":"F", "ScaleType":"Whole-half"},
{"Tonic":"F", "ScaleType":"Whole Tone"},
{"Tonic":"F", "ScaleType":"Minor Blues"},
{"Tonic":"F", "ScaleType":"Minor Pentatonic"},
{"Tonic":"F", "ScaleType":"Major Pentatonic"},
{"Tonic":"F", "ScaleType":"Harmonic Minor"},
{"Tonic":"F", "ScaleType":"Melodic Minor"},
{"Tonic":"F", "ScaleType":"Super Locrian"},
{"Tonic":"F", "ScaleType":"Bhairav"},
{"Tonic":"F", "ScaleType":"Hungarian Minor"},
{"Tonic":"F", "ScaleType":"Minor Gypsy"},
{"Tonic":"F", "ScaleType":"Hirojoshi"},
{"Tonic":"F", "ScaleType":"In-Sen"},
{"Tonic":"F", "ScaleType":"Iwato"},
{"Tonic":"F", "ScaleType":"Kumoi"},
{"Tonic":"F", "ScaleType":"Pelog"},
{"Tonic":"F", "ScaleType":"Spanish"},
{"Tonic":"Bb", "ScaleType":"Major"},
{"Tonic":"Bb", "ScaleType":"Minor"},
{"Tonic":"Bb", "ScaleType":"Dorian"},
{"Tonic":"Bb", "ScaleType":"Mixolydian"},
{"Tonic":"Bb", "ScaleType":"Lydian"},
{"Tonic":"Bb", "ScaleType":"Phrygian"},
{"Tonic":"Bb", "ScaleType":"Locrian"},
{"Tonic":"Bb", "ScaleType":"Diminished"},
{"Tonic":"Bb", "ScaleType":"Whole-half"},
{"Tonic":"Bb", "ScaleType":"Whole Tone"},
{"Tonic":"Bb", "ScaleType":"Minor Blues"},
{"Tonic":"Bb", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Bb", "ScaleType":"Major Pentatonic"},
{"Tonic":"Bb", "ScaleType":"Harmonic Minor"},
{"Tonic":"Bb", "ScaleType":"Melodic Minor"},
{"Tonic":"Bb", "ScaleType":"Super Locrian"},
{"Tonic":"Bb", "ScaleType":"Bhairav"},
{"Tonic":"Bb", "ScaleType":"Hungarian Minor"},
{"Tonic":"Bb", "ScaleType":"Minor Gypsy"},
{"Tonic":"Bb", "ScaleType":"Hirojoshi"},
{"Tonic":"Bb", "ScaleType":"In-Sen"},
{"Tonic":"Bb", "ScaleType":"Iwato"},
{"Tonic":"Bb", "ScaleType":"Kumoi"},
{"Tonic":"Bb", "ScaleType":"Pelog"},
{"Tonic":"Bb", "ScaleType":"Spanish"},
{"Tonic":"Eb", "ScaleType":"Major"},
{"Tonic":"Eb", "ScaleType":"Minor"},
{"Tonic":"Eb", "ScaleType":"Dorian"},
{"Tonic":"Eb", "ScaleType":"Mixolydian"},
{"Tonic":"Eb", "ScaleType":"Lydian"},
{"Tonic":"Eb", "ScaleType":"Phrygian"},
{"Tonic":"Eb", "ScaleType":"Locrian"},
{"Tonic":"Eb", "ScaleType":"Diminished"},
{"Tonic":"Eb", "ScaleType":"Whole-half"},
{"Tonic":"Eb", "ScaleType":"Whole Tone"},
{"Tonic":"Eb", "ScaleType":"Minor Blues"},
{"Tonic":"Eb", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Eb", "ScaleType":"Major Pentatonic"},
{"Tonic":"Eb", "ScaleType":"Harmonic Minor"},
{"Tonic":"Eb", "ScaleType":"Melodic Minor"},
{"Tonic":"Eb", "ScaleType":"Super Locrian"},
{"Tonic":"Eb", "ScaleType":"Bhairav"},
{"Tonic":"Eb", "ScaleType":"Hungarian Minor"},
{"Tonic":"Eb", "ScaleType":"Minor Gypsy"},
{"Tonic":"Eb", "ScaleType":"Hirojoshi"},
{"Tonic":"Eb", "ScaleType":"In-Sen"},
{"Tonic":"Eb", "ScaleType":"Iwato"},
{"Tonic":"Eb", "ScaleType":"Kumoi"},
{"Tonic":"Eb", "ScaleType":"Pelog"},
{"Tonic":"Eb", "ScaleType":"Spanish"},
{"Tonic":"Ab", "ScaleType":"Major"},
{"Tonic":"Ab", "ScaleType":"Minor"},
{"Tonic":"Ab", "ScaleType":"Dorian"},
{"Tonic":"Ab", "ScaleType":"Mixolydian"},
{"Tonic":"Ab", "ScaleType":"Lydian"},
{"Tonic":"Ab", "ScaleType":"Phrygian"},
{"Tonic":"Ab", "ScaleType":"Locrian"},
{"Tonic":"Ab", "ScaleType":"Diminished"},
{"Tonic":"Ab", "ScaleType":"Whole-half"},
{"Tonic":"Ab", "ScaleType":"Whole Tone"},
{"Tonic":"Ab", "ScaleType":"Minor Blues"},
{"Tonic":"Ab", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Ab", "ScaleType":"Major Pentatonic"},
{"Tonic":"Ab", "ScaleType":"Harmonic Minor"},
{"Tonic":"Ab", "ScaleType":"Melodic Minor"},
{"Tonic":"Ab", "ScaleType":"Super Locrian"},
{"Tonic":"Ab", "ScaleType":"Bhairav"},
{"Tonic":"Ab", "ScaleType":"Hungarian Minor"},
{"Tonic":"Ab", "ScaleType":"Minor Gypsy"},
{"Tonic":"Ab", "ScaleType":"Hirojoshi"},
{"Tonic":"Ab", "ScaleType":"In-Sen"},
{"Tonic":"Ab", "ScaleType":"Iwato"},
{"Tonic":"Ab", "ScaleType":"Kumoi"},
{"Tonic":"Ab", "ScaleType":"Pelog"},
{"Tonic":"Ab", "ScaleType":"Spanish"},
{"Tonic":"Db", "ScaleType":"Major"},
{"Tonic":"Db", "ScaleType":"Minor"},
{"Tonic":"Db", "ScaleType":"Dorian"},
{"Tonic":"Db", "ScaleType":"Mixolydian"},
{"Tonic":"Db", "ScaleType":"Lydian"},
{"Tonic":"Db", "ScaleType":"Phrygian"},
{"Tonic":"Db", "ScaleType":"Locrian"},
{"Tonic":"Db", "ScaleType":"Diminished"},
{"Tonic":"Db", "ScaleType":"Whole-half"},
{"Tonic":"Db", "ScaleType":"Whole Tone"},
{"Tonic":"Db", "ScaleType":"Minor Blues"},
{"Tonic":"Db", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Db", "ScaleType":"Major Pentatonic"},
{"Tonic":"Db", "ScaleType":"Harmonic Minor"},
{"Tonic":"Db", "ScaleType":"Melodic Minor"},
{"Tonic":"Db", "ScaleType":"Super Locrian"},
{"Tonic":"Db", "ScaleType":"Bhairav"},
{"Tonic":"Db", "ScaleType":"Hungarian Minor"},
{"Tonic":"Db", "ScaleType":"Minor Gypsy"},
{"Tonic":"Db", "ScaleType":"Hirojoshi"},
{"Tonic":"Db", "ScaleType":"In-Sen"},
{"Tonic":"Db", "ScaleType":"Iwato"},
{"Tonic":"Db", "ScaleType":"Kumoi"},
{"Tonic":"Db", "ScaleType":"Pelog"},
{"Tonic":"Db", "ScaleType":"Spanish"},
{"Tonic":"Gb", "ScaleType":"Major"},
{"Tonic":"Gb", "ScaleType":"Minor"},
{"Tonic":"Gb", "ScaleType":"Dorian"},
{"Tonic":"Gb", "ScaleType":"Mixolydian"},
{"Tonic":"Gb", "ScaleType":"Lydian"},
{"Tonic":"Gb", "ScaleType":"Phrygian"},
{"Tonic":"Gb", "ScaleType":"Locrian"},
{"Tonic":"Gb", "ScaleType":"Diminished"},
{"Tonic":"Gb", "ScaleType":"Whole-half"},
{"Tonic":"Gb", "ScaleType":"Whole Tone"},
{"Tonic":"Gb", "ScaleType":"Minor Blues"},
{"Tonic":"Gb", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Gb", "ScaleType":"Major Pentatonic"},
{"Tonic":"Gb", "ScaleType":"Harmonic Minor"},
{"Tonic":"Gb", "ScaleType":"Melodic Minor"},
{"Tonic":"Gb", "ScaleType":"Super Locrian"},
{"Tonic":"Gb", "ScaleType":"Bhairav"},
{"Tonic":"Gb", "ScaleType":"Hungarian Minor"},
{"Tonic":"Gb", "ScaleType":"Minor Gypsy"},
{"Tonic":"Gb", "ScaleType":"Hirojoshi"},
{"Tonic":"Gb", "ScaleType":"In-Sen"},
{"Tonic":"Gb", "ScaleType":"Iwato"},
{"Tonic":"Gb", "ScaleType":"Kumoi"},
{"Tonic":"Gb", "ScaleType":"Pelog"},
{"Tonic":"Gb", "ScaleType":"Spanish"}

Open in new window

0
PeterBaileyUk
Asked:
PeterBaileyUk
  • 3
  • 2
  • 2
1 Solution
 
RobOwner (Aidellio)Commented:
just use the JSON.parse(); function :)

e.g. (http://www.w3schools.com/js/js_json.asp)
var text = '{ "employees" : [' +
'{ "firstName":"John" , "lastName":"Doe" },' +
'{ "firstName":"Anna" , "lastName":"Smith" },' +
'{ "firstName":"Peter" , "lastName":"Jones" } ]}';

var obj = JSON.parse(text);

Open in new window


Here's a demo using your json: http://jsbin.com/gokijifore/edit?js,console
0
 
Julian HansenCommented:
You don't need to parse it just do this
put a var x = [ in front and a ] at the end - this puts the objects into a javascript array of objects and assigns it to x. You can put this in a separat javascript file and just included it before you need it.
var x = [{"Tonic":"C","ScaleType":"Whole Tone"},
{"Tonic":"C", "ScaleType":"Minor Blues"},
{"Tonic":"C", "ScaleType":"Minor Pentatonic"},
{"Tonic":"C", "ScaleType":"Major Pentatonic"},
{"Tonic":"C", "ScaleType":"Harmonic Minor"},
{"Tonic":"C", "ScaleType":"Melodic Minor"},
{"Tonic":"C", "ScaleType":"Super Locrian"},
{"Tonic":"C", "ScaleType":"Bhairav"},
{"Tonic":"C", "ScaleType":"Hungarian Minor"},
{"Tonic":"C", "ScaleType":"Minor Gypsy"},
{"Tonic":"C", "ScaleType":"Hirojoshi"},
{"Tonic":"C", "ScaleType":"In-Sen"},
{"Tonic":"C", "ScaleType":"Iwato"},
{"Tonic":"C", "ScaleType":"Kumoi"},
{"Tonic":"C", "ScaleType":"Pelog"},
{"Tonic":"C", "ScaleType":"Spanish"},
{"Tonic":"D", "ScaleType":"Major"},
{"Tonic":"D", "ScaleType":"Minor"},
{"Tonic":"D", "ScaleType":"Dorian"},
{"Tonic":"D", "ScaleType":"Mixolydian"},
{"Tonic":"D", "ScaleType":"Lydian"},
{"Tonic":"D", "ScaleType":"Phrygian"},
{"Tonic":"D", "ScaleType":"Locrian"},
{"Tonic":"D", "ScaleType":"Diminished"},
{"Tonic":"D", "ScaleType":"Whole-half"},
{"Tonic":"D", "ScaleType":"Whole Tone"},
{"Tonic":"D", "ScaleType":"Minor Blues"},
{"Tonic":"D", "ScaleType":"Minor Pentatonic"},
{"Tonic":"D", "ScaleType":"Major Pentatonic"},
{"Tonic":"D", "ScaleType":"Harmonic Minor"},
{"Tonic":"D", "ScaleType":"Melodic Minor"},
{"Tonic":"D", "ScaleType":"Super Locrian"},
{"Tonic":"D", "ScaleType":"Bhairav"},
{"Tonic":"D", "ScaleType":"Hungarian Minor"},
{"Tonic":"D", "ScaleType":"Minor Gypsy"},
{"Tonic":"D", "ScaleType":"Hirojoshi"},
{"Tonic":"D", "ScaleType":"In-Sen"},
{"Tonic":"D", "ScaleType":"Iwato"},
{"Tonic":"D", "ScaleType":"Kumoi"},
{"Tonic":"D", "ScaleType":"Pelog"},
{"Tonic":"D", "ScaleType":"Spanish"},
{"Tonic":"E", "ScaleType":"Major"},
{"Tonic":"E", "ScaleType":"Minor"},
{"Tonic":"E", "ScaleType":"Dorian"},
{"Tonic":"E", "ScaleType":"Mixolydian"},
{"Tonic":"E", "ScaleType":"Lydian"},
{"Tonic":"E", "ScaleType":"Phrygian"},
{"Tonic":"E", "ScaleType":"Locrian"},
{"Tonic":"E", "ScaleType":"Diminished"},
{"Tonic":"E", "ScaleType":"Whole-half"},
{"Tonic":"E", "ScaleType":"Whole Tone"},
{"Tonic":"E", "ScaleType":"Minor Blues"},
{"Tonic":"E", "ScaleType":"Minor Pentatonic"},
{"Tonic":"E", "ScaleType":"Major Pentatonic"},
{"Tonic":"E", "ScaleType":"Harmonic Minor"},
{"Tonic":"E", "ScaleType":"Melodic Minor"},
{"Tonic":"E", "ScaleType":"Super Locrian"},
{"Tonic":"E", "ScaleType":"Bhairav"},
{"Tonic":"E", "ScaleType":"Hungarian Minor"},
{"Tonic":"E", "ScaleType":"Minor Gypsy"},
{"Tonic":"E", "ScaleType":"Hirojoshi"},
{"Tonic":"E", "ScaleType":"In-Sen"},
{"Tonic":"E", "ScaleType":"Iwato"},
{"Tonic":"E", "ScaleType":"Kumoi"},
{"Tonic":"E", "ScaleType":"Pelog"},
{"Tonic":"E", "ScaleType":"Spanish"},
{"Tonic":"A", "ScaleType":"Major"},
{"Tonic":"A", "ScaleType":"Minor"},
{"Tonic":"A", "ScaleType":"Dorian"},
{"Tonic":"A", "ScaleType":"Mixolydian"},
{"Tonic":"A", "ScaleType":"Lydian"},
{"Tonic":"A", "ScaleType":"Phrygian"},
{"Tonic":"A", "ScaleType":"Locrian"},
{"Tonic":"A", "ScaleType":"Diminished"},
{"Tonic":"A", "ScaleType":"Whole-half"},
{"Tonic":"A", "ScaleType":"Whole Tone"},
{"Tonic":"A", "ScaleType":"Minor Blues"},
{"Tonic":"A", "ScaleType":"Minor Pentatonic"},
{"Tonic":"A", "ScaleType":"Major Pentatonic"},
{"Tonic":"A", "ScaleType":"Harmonic Minor"},
{"Tonic":"A", "ScaleType":"Melodic Minor"},
{"Tonic":"A", "ScaleType":"Super Locrian"},
{"Tonic":"A", "ScaleType":"Bhairav"},
{"Tonic":"A", "ScaleType":"Hungarian Minor"},
{"Tonic":"A", "ScaleType":"Minor Gypsy"},
{"Tonic":"A", "ScaleType":"Hirojoshi"},
{"Tonic":"A", "ScaleType":"In-Sen"},
{"Tonic":"A", "ScaleType":"Iwato"},
{"Tonic":"A", "ScaleType":"Kumoi"},
{"Tonic":"A", "ScaleType":"Pelog"},
{"Tonic":"A", "ScaleType":"Spanish"},
{"Tonic":"B", "ScaleType":"Major"},
{"Tonic":"B", "ScaleType":"Minor"},
{"Tonic":"B", "ScaleType":"Dorian"},
{"Tonic":"B", "ScaleType":"Mixolydian"},
{"Tonic":"B", "ScaleType":"Lydian"},
{"Tonic":"B", "ScaleType":"Phrygian"},
{"Tonic":"B", "ScaleType":"Locrian"},
{"Tonic":"B", "ScaleType":"Diminished"},
{"Tonic":"B", "ScaleType":"Whole-half"},
{"Tonic":"B", "ScaleType":"Whole Tone"},
{"Tonic":"B", "ScaleType":"Minor Blues"},
{"Tonic":"B", "ScaleType":"Minor Pentatonic"},
{"Tonic":"B", "ScaleType":"Major Pentatonic"},
{"Tonic":"B", "ScaleType":"Harmonic Minor"},
{"Tonic":"B", "ScaleType":"Melodic Minor"},
{"Tonic":"B", "ScaleType":"Super Locrian"},
{"Tonic":"B", "ScaleType":"Bhairav"},
{"Tonic":"B", "ScaleType":"Hungarian Minor"},
{"Tonic":"B", "ScaleType":"Minor Gypsy"},
{"Tonic":"B", "ScaleType":"Hirojoshi"},
{"Tonic":"B", "ScaleType":"In-Sen"},
{"Tonic":"B", "ScaleType":"Iwato"},
{"Tonic":"B", "ScaleType":"Kumoi"},
{"Tonic":"B", "ScaleType":"Pelog"},
{"Tonic":"B", "ScaleType":"Spanish"},
{"Tonic":"G", "ScaleType":"Major"},
{"Tonic":"G", "ScaleType":"Minor"},
{"Tonic":"G", "ScaleType":"Dorian"},
{"Tonic":"G", "ScaleType":"Mixolydian"},
{"Tonic":"G", "ScaleType":"Lydian"},
{"Tonic":"G", "ScaleType":"Phrygian"},
{"Tonic":"G", "ScaleType":"Locrian"},
{"Tonic":"G", "ScaleType":"Diminished"},
{"Tonic":"G", "ScaleType":"Whole-half"},
{"Tonic":"G", "ScaleType":"Whole Tone"},
{"Tonic":"G", "ScaleType":"Minor Blues"},
{"Tonic":"G", "ScaleType":"Minor Pentatonic"},
{"Tonic":"G", "ScaleType":"Major Pentatonic"},
{"Tonic":"G", "ScaleType":"Harmonic Minor"},
{"Tonic":"G", "ScaleType":"Melodic Minor"},
{"Tonic":"G", "ScaleType":"Super Locrian"},
{"Tonic":"G", "ScaleType":"Bhairav"},
{"Tonic":"G", "ScaleType":"Hungarian Minor"},
{"Tonic":"G", "ScaleType":"Minor Gypsy"},
{"Tonic":"G", "ScaleType":"Hirojoshi"},
{"Tonic":"G", "ScaleType":"In-Sen"},
{"Tonic":"G", "ScaleType":"Iwato"},
{"Tonic":"G", "ScaleType":"Kumoi"},
{"Tonic":"G", "ScaleType":"Pelog"},
{"Tonic":"G", "ScaleType":"Spanish"},
{"Tonic":"F", "ScaleType":"Major"},
{"Tonic":"F", "ScaleType":"Minor"},
{"Tonic":"F", "ScaleType":"Dorian"},
{"Tonic":"F", "ScaleType":"Mixolydian"},
{"Tonic":"F", "ScaleType":"Lydian"},
{"Tonic":"F", "ScaleType":"Phrygian"},
{"Tonic":"F", "ScaleType":"Locrian"},
{"Tonic":"F", "ScaleType":"Diminished"},
{"Tonic":"F", "ScaleType":"Whole-half"},
{"Tonic":"F", "ScaleType":"Whole Tone"},
{"Tonic":"F", "ScaleType":"Minor Blues"},
{"Tonic":"F", "ScaleType":"Minor Pentatonic"},
{"Tonic":"F", "ScaleType":"Major Pentatonic"},
{"Tonic":"F", "ScaleType":"Harmonic Minor"},
{"Tonic":"F", "ScaleType":"Melodic Minor"},
{"Tonic":"F", "ScaleType":"Super Locrian"},
{"Tonic":"F", "ScaleType":"Bhairav"},
{"Tonic":"F", "ScaleType":"Hungarian Minor"},
{"Tonic":"F", "ScaleType":"Minor Gypsy"},
{"Tonic":"F", "ScaleType":"Hirojoshi"},
{"Tonic":"F", "ScaleType":"In-Sen"},
{"Tonic":"F", "ScaleType":"Iwato"},
{"Tonic":"F", "ScaleType":"Kumoi"},
{"Tonic":"F", "ScaleType":"Pelog"},
{"Tonic":"F", "ScaleType":"Spanish"},
{"Tonic":"Bb", "ScaleType":"Major"},
{"Tonic":"Bb", "ScaleType":"Minor"},
{"Tonic":"Bb", "ScaleType":"Dorian"},
{"Tonic":"Bb", "ScaleType":"Mixolydian"},
{"Tonic":"Bb", "ScaleType":"Lydian"},
{"Tonic":"Bb", "ScaleType":"Phrygian"},
{"Tonic":"Bb", "ScaleType":"Locrian"},
{"Tonic":"Bb", "ScaleType":"Diminished"},
{"Tonic":"Bb", "ScaleType":"Whole-half"},
{"Tonic":"Bb", "ScaleType":"Whole Tone"},
{"Tonic":"Bb", "ScaleType":"Minor Blues"},
{"Tonic":"Bb", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Bb", "ScaleType":"Major Pentatonic"},
{"Tonic":"Bb", "ScaleType":"Harmonic Minor"},
{"Tonic":"Bb", "ScaleType":"Melodic Minor"},
{"Tonic":"Bb", "ScaleType":"Super Locrian"},
{"Tonic":"Bb", "ScaleType":"Bhairav"},
{"Tonic":"Bb", "ScaleType":"Hungarian Minor"},
{"Tonic":"Bb", "ScaleType":"Minor Gypsy"},
{"Tonic":"Bb", "ScaleType":"Hirojoshi"},
{"Tonic":"Bb", "ScaleType":"In-Sen"},
{"Tonic":"Bb", "ScaleType":"Iwato"},
{"Tonic":"Bb", "ScaleType":"Kumoi"},
{"Tonic":"Bb", "ScaleType":"Pelog"},
{"Tonic":"Bb", "ScaleType":"Spanish"},
{"Tonic":"Eb", "ScaleType":"Major"},
{"Tonic":"Eb", "ScaleType":"Minor"},
{"Tonic":"Eb", "ScaleType":"Dorian"},
{"Tonic":"Eb", "ScaleType":"Mixolydian"},
{"Tonic":"Eb", "ScaleType":"Lydian"},
{"Tonic":"Eb", "ScaleType":"Phrygian"},
{"Tonic":"Eb", "ScaleType":"Locrian"},
{"Tonic":"Eb", "ScaleType":"Diminished"},
{"Tonic":"Eb", "ScaleType":"Whole-half"},
{"Tonic":"Eb", "ScaleType":"Whole Tone"},
{"Tonic":"Eb", "ScaleType":"Minor Blues"},
{"Tonic":"Eb", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Eb", "ScaleType":"Major Pentatonic"},
{"Tonic":"Eb", "ScaleType":"Harmonic Minor"},
{"Tonic":"Eb", "ScaleType":"Melodic Minor"},
{"Tonic":"Eb", "ScaleType":"Super Locrian"},
{"Tonic":"Eb", "ScaleType":"Bhairav"},
{"Tonic":"Eb", "ScaleType":"Hungarian Minor"},
{"Tonic":"Eb", "ScaleType":"Minor Gypsy"},
{"Tonic":"Eb", "ScaleType":"Hirojoshi"},
{"Tonic":"Eb", "ScaleType":"In-Sen"},
{"Tonic":"Eb", "ScaleType":"Iwato"},
{"Tonic":"Eb", "ScaleType":"Kumoi"},
{"Tonic":"Eb", "ScaleType":"Pelog"},
{"Tonic":"Eb", "ScaleType":"Spanish"},
{"Tonic":"Ab", "ScaleType":"Major"},
{"Tonic":"Ab", "ScaleType":"Minor"},
{"Tonic":"Ab", "ScaleType":"Dorian"},
{"Tonic":"Ab", "ScaleType":"Mixolydian"},
{"Tonic":"Ab", "ScaleType":"Lydian"},
{"Tonic":"Ab", "ScaleType":"Phrygian"},
{"Tonic":"Ab", "ScaleType":"Locrian"},
{"Tonic":"Ab", "ScaleType":"Diminished"},
{"Tonic":"Ab", "ScaleType":"Whole-half"},
{"Tonic":"Ab", "ScaleType":"Whole Tone"},
{"Tonic":"Ab", "ScaleType":"Minor Blues"},
{"Tonic":"Ab", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Ab", "ScaleType":"Major Pentatonic"},
{"Tonic":"Ab", "ScaleType":"Harmonic Minor"},
{"Tonic":"Ab", "ScaleType":"Melodic Minor"},
{"Tonic":"Ab", "ScaleType":"Super Locrian"},
{"Tonic":"Ab", "ScaleType":"Bhairav"},
{"Tonic":"Ab", "ScaleType":"Hungarian Minor"},
{"Tonic":"Ab", "ScaleType":"Minor Gypsy"},
{"Tonic":"Ab", "ScaleType":"Hirojoshi"},
{"Tonic":"Ab", "ScaleType":"In-Sen"},
{"Tonic":"Ab", "ScaleType":"Iwato"},
{"Tonic":"Ab", "ScaleType":"Kumoi"},
{"Tonic":"Ab", "ScaleType":"Pelog"},
{"Tonic":"Ab", "ScaleType":"Spanish"},
{"Tonic":"Db", "ScaleType":"Major"},
{"Tonic":"Db", "ScaleType":"Minor"},
{"Tonic":"Db", "ScaleType":"Dorian"},
{"Tonic":"Db", "ScaleType":"Mixolydian"},
{"Tonic":"Db", "ScaleType":"Lydian"},
{"Tonic":"Db", "ScaleType":"Phrygian"},
{"Tonic":"Db", "ScaleType":"Locrian"},
{"Tonic":"Db", "ScaleType":"Diminished"},
{"Tonic":"Db", "ScaleType":"Whole-half"},
{"Tonic":"Db", "ScaleType":"Whole Tone"},
{"Tonic":"Db", "ScaleType":"Minor Blues"},
{"Tonic":"Db", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Db", "ScaleType":"Major Pentatonic"},
{"Tonic":"Db", "ScaleType":"Harmonic Minor"},
{"Tonic":"Db", "ScaleType":"Melodic Minor"},
{"Tonic":"Db", "ScaleType":"Super Locrian"},
{"Tonic":"Db", "ScaleType":"Bhairav"},
{"Tonic":"Db", "ScaleType":"Hungarian Minor"},
{"Tonic":"Db", "ScaleType":"Minor Gypsy"},
{"Tonic":"Db", "ScaleType":"Hirojoshi"},
{"Tonic":"Db", "ScaleType":"In-Sen"},
{"Tonic":"Db", "ScaleType":"Iwato"},
{"Tonic":"Db", "ScaleType":"Kumoi"},
{"Tonic":"Db", "ScaleType":"Pelog"},
{"Tonic":"Db", "ScaleType":"Spanish"},
{"Tonic":"Gb", "ScaleType":"Major"},
{"Tonic":"Gb", "ScaleType":"Minor"},
{"Tonic":"Gb", "ScaleType":"Dorian"},
{"Tonic":"Gb", "ScaleType":"Mixolydian"},
{"Tonic":"Gb", "ScaleType":"Lydian"},
{"Tonic":"Gb", "ScaleType":"Phrygian"},
{"Tonic":"Gb", "ScaleType":"Locrian"},
{"Tonic":"Gb", "ScaleType":"Diminished"},
{"Tonic":"Gb", "ScaleType":"Whole-half"},
{"Tonic":"Gb", "ScaleType":"Whole Tone"},
{"Tonic":"Gb", "ScaleType":"Minor Blues"},
{"Tonic":"Gb", "ScaleType":"Minor Pentatonic"},
{"Tonic":"Gb", "ScaleType":"Major Pentatonic"},
{"Tonic":"Gb", "ScaleType":"Harmonic Minor"},
{"Tonic":"Gb", "ScaleType":"Melodic Minor"},
{"Tonic":"Gb", "ScaleType":"Super Locrian"},
{"Tonic":"Gb", "ScaleType":"Bhairav"},
{"Tonic":"Gb", "ScaleType":"Hungarian Minor"},
{"Tonic":"Gb", "ScaleType":"Minor Gypsy"},
{"Tonic":"Gb", "ScaleType":"Hirojoshi"},
{"Tonic":"Gb", "ScaleType":"In-Sen"},
{"Tonic":"Gb", "ScaleType":"Iwato"},
{"Tonic":"Gb", "ScaleType":"Kumoi"},
{"Tonic":"Gb", "ScaleType":"Pelog"},
{"Tonic":"Gb", "ScaleType":"Spanish"}]

Open in new window

0
 
Julian HansenCommented:
See this sample based on the above - F12 to view the output in the console
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PeterBaileyUkAuthor Commented:
I followed the link but to no avail, I got the code in, I am unsure about the file side i just want to create a demo first and then move the design over to an android app.
I assume now its in the code I can access the records somehow. I am guessing x is an array now.
0
 
RobOwner (Aidellio)Commented:
Peter,

You've accepted a solution though your last comment would indicate otherwise.

Can you confirm how you're loading or inserting the json? As Julian had said JavaScript well automatically parse json as an object. The edge case is if the data is in string format.
0
 
PeterBaileyUkAuthor Commented:
I felt that if i were to ask more i should raise another question as only fair
0
 
Julian HansenCommented:
I followed the link but to no avail,
Press F12 on the page to view the console. The page itself has not output - the output is a dump of the object to the console.
If you want to use it then do this

Save the file to myobject.js (for arguments sake)
Then
<script src="myobject.js"></script>
<script>
for(var item in myobject) {
   // access the current object in the array here
   alert(myobject[x].ScaleType);
}
</script>

Open in new window


I have put together a sample that demonstrates the concept. The sample includes the JSON file as a JavaScript file in standard <script> tags and then iterates through the object and dynamically adds the value to a table.

You can see the sample here
1

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now