Nit pick but you could make a call to JSON.parse once instead of potentially twice (line 37 and 44).