I want to convert full object to String in JS.
The Object is as below :-
{ parent : { "a":1, testFunc(){ return 2;} } }
When i use
JSON.stringify({parent : {"a":1, testFunc(){ return 2;} } })
-Actual :- I get "{"parent":{"a":1}}" as the output
- Expected :-
but i wanted output as "{"parent":{"a":1,testFunc(){return 2;}}}"
Is there any way to keep the function's in string as JSON.stringify removes the function.