Employers: discover CodinGame for tech hiring
Practice
Compete
1
Contribute
Learn
1
Log In
Sign Up
How to format an Object into JSON in Java
[CG]BOUGA
9,675 views
Using
Gson
JSON.java
User.java
1
8
9
10
11
12
13
14
15
20
// {
User user = new User("Bob", 123);
String json = new Gson().toJson(user);
System.out.println(json);
// {
1
public class User {
Run
3
0
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
Suggested playgrounds
How to test if a List contains a specific value in Java
By
[CG]BOUGA
24.3K
8
1
👨🎓 How to parse JSON in Java
By
[CG]BOUGA
21.5K
2
0
Java 8 Stream map tutorial
By
Unnamed contributor
3,831
14
0
Reactive Programming with Reactor 3
By
Reactor
300.8K
287
32
CodinGame - Home
ABOUT US
CAREERS
PRIVACY
FAQ
CodinGame - Work
The #1 tech hiring platform
SCREENING
SOURCING
RETAIN
ABOUT US
CAREERS
PRIVACY
FAQ
Facebook
YouTube
Twitter
LinkedIn
FR
EN
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants
Keyboard Shortcuts:
?
Show / hide this help menu
×