JSON decoder error fixed by changing stack indexing to -1 from 1