FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Gson-Examples/GsonPrettyPrinting.java at master · janbodnar/Java-Gson-Examples · GitHub
janbodnar
/
Java-Gson-Examples
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
7
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Gson-Examples
/
GsonPrettyPrinting.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (17 loc) · 533 Bytes
Breadcrumbs
Java-Gson-Examples
/
GsonPrettyPrinting.java
Copy path
File metadata and controls
24 lines (17 loc) · 533 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package
com
.
zetcode
;
import
com
.
google
.
gson
.
Gson
;
import
com
.
google
.
gson
.
GsonBuilder
;
import
java
.
util
.
HashMap
;
import
java
.
util
.
Map
;
public
class
GsonPrettyPrinting
{
public
static
void
main
(
String
[]
args
) {
Gson
gson
=
new
GsonBuilder
()
.
setPrettyPrinting
()
.
create
();
Map
<
String
,
Integer
>
items
=
new
HashMap
<>();
items
.
put
(
"chair"
,
3
);
items
.
put
(
"pencil"
,
1
);
items
.
put
(
"book"
,
5
);
gson
.
toJson
(
items
,
System
.
out
);
}
}
Back
|
FazBrowse Home
|
New Git URL