Home > front end >  JS encapsulation
JS encapsulation

Time:09-16

If it is an empty object how to package?

CodePudding user response:

I know the
JSONObject js=new JSONObject ();
Js. Put (" name ", js);
This is the name of an empty object

CodePudding user response:

Write directly {}

CodePudding user response:

reference 1/f World 'sdream response:
I know
JSONObject js=new JSONObject ();
Js. Put (" name ", js);
This is the name of an empty object


You this is a Java

CodePudding user response:

reference 3/f o raccoon dog beibei response:
Quote: refer to 1st floor World 'sdream response:
I know
JSONObject js=new JSONObject ();
Js. Put (" name ", js);
This is the name of an empty object


You this is a Java

For

CodePudding user response:

reference 3/f o raccoon dog beibei response:
Quote: refer to 1st floor World 'sdream response:
I know
JSONObject js=new JSONObject ();
Js. Put (" name ", js);
This is the name of an empty object


You this is a Java

For

CodePudding user response:

reference 3/f o raccoon dog beibei response:
Quote: refer to 1st floor World 'sdream response:
I know
JSONObject js=new JSONObject ();
Js. Put (" name ", js);
This is the name of an empty object


You this is a Java

For

CodePudding user response:

JSON. Parse (JSON. Stringify ({}))
Is this?

CodePudding user response:

Don't know the answer if you want to:
The value of the object is null or undefined but we are encapsulation,
How to do?
Say, in the use of JSON. The parse () object, but it would be an error parameter can be null
So JSON. Parse (XXX | | '{}'), it is written in the browser compatible learned, is to use | | operators,
In front of the empty, will read back, return the value is not null, or the last value

CodePudding user response:

refer to 7th floor gqkmiss response:
JSON. Parse (JSON. Stringify ({}))
Is this?

I can't write so feel

CodePudding user response:

references 9 f World 'sdream response:
Quote: refer to 7th floor gqkmiss response:
JSON. Parse (JSON. Stringify ({}))
Is this?

I can't write so feel


May have a look the JSON. Stringify ()
  • Related