`if (secure == null) secure = JSON.secure;`

You need to define `JSON.secure = true;` outside  `JSON.decode`