Cordova JSON.stringify is not a function

924 Views Asked by At

Hi I'm trying to create a mobile app using cordova with framework7. The problem is when I try to use JSON.stringfy to turn some object to JSON string, I'm getting JSON.stringify is not a function(I guess framework7 does not support), therefore If someone can suggest me another way to turn an unspecified object to JSON string it would be awesome.

2

There are 2 best solutions below

2
ehrencrona On BEST ANSWER

JSON.stringify is present in pretty much every browser. Could it be that you have a variable called JSON or that you have overwritten the global JSON object? Try printing the value of JSON to check that.

1
salih kallai On

Cordova doesn't let you parse json, you parse json with javascript (like crokford json parser library or jquery json parsing methods) the only thing cordova does is expose the native api of various mobile operation systems to a common javascript interface.