[SOLVED] Changing key value


#1

I have json data that changes weekly [nfl scores]…

Easy to parse except the key value changes weekly.
Here’s some of the json data …

  {"2018091000":{"home":{"score":{"1":7,"2":3,"3":7,"4":0,"5":0,"T":17},"abbr":"DET","to":3},"away":{"score":{"1":7,"2":10,"3":14,"4":0,"5":0,"T":31},"abbr":"NYJ","to":3},"bp":9,"down":2,"togo":9,"clock":"08:07","posteam":"DET","note":null,"redzone":false,"stadium":"Ford Field","media":{"radio":{"home":null,"away":null},"tv":"ESPN","sat":null,"sathd":null},"yl":"DET 26","qtr":"3"},

"2018090903":{"home":{"score":{"1":0,"2":7,"3":3,"4":17,"5":0,"T":27},"abbr":"MIA","to":1},"away":{"score":{"1":3,"2":0,"3":0,"4":17,"5":0,"T":20},"abbr":"TEN","to":0},"bp":16,"down":0,"togo":0,"clock":"00:10","posteam":"MIA","note":null,"redzone":false,"stadium":"Hard Rock Stadium","media":{"radio":{"home":null,"away":null},"tv":"FOX","sat":null,"sathd":null},"yl":"","qtr":"Final"}

Those are two examples…I know what the key 2018090903 means [it’s a date and the 03 on the end is the game number that day]…but it changes weekly. What i’m trying to do is change that key value to ‘game’ so that every week I can just parse the data easily since weekly especially towards to the end of the season…

I apologize because I have no idea where to even begin with this one… LOL So I have no code to start with…just looking for suggestions.

Thanks!


#2

If you loop through the return values, it wont matter.


#3

OH OK I see what you’re saying…Thank you!! Trying to make something simple hard I guess :slight_smile: