undef error - malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "