1

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.

Yakup Türkan
  • 576
  • 2
  • 6
  • 21

2 Answers2

1

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.

ehrencrona
  • 6,102
  • 1
  • 18
  • 24
  • How do I check If I overwrite global JSON object? Every attempt I made yield the [object Object] result at the end. – Yakup Türkan Nov 28 '17 at 10:37
  • Then you probably did overwrite it. If I run `console.log(JSON)` in Safari, I get `JSON {Symbol(Symbol.toStringTag): "JSON"}`. If you get something else, the object has been overwritten. – ehrencrona Nov 28 '17 at 11:20
1

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.

salih kallai
  • 879
  • 2
  • 13
  • 34