Skip to content

Commit d35ef20

Browse files
committed
Gson for Java example code added
1 parent 3b8654a commit d35ef20

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@
120120
</div>
121121
</div>
122122
<div class="col-sm-5">
123+
<div class="alert alert-danger" role="alert" id="errorAlert">
124+
</div>
123125
<div class="form-group bg-secondary text-light border border-secondary rounded p-2">
124126
<label for="input">Input JSON:</label>
125127
<textarea class="form-control form-font" rows="25" id="input"></textarea>
126128
</div>
127-
<div class="alert alert-danger" role="alert" id="errorAlert">
128-
</div>
129129
<div class="alert alert-secondary" role="alert" id="exampleCode">
130130
</div>
131131
</div>

languages/JavaGson.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,6 @@
131131
"checked": ""
132132
}
133133
}
134-
}
134+
},
135+
"exampleCode": "## Example\n\n\n#### Decoding:\nThe example below shows how to decode an instance of `<!RootClassName>` type from JSON object.\n\n```java\nString json = \"...\"; // Your JSON String.\n\nGsonBuilder builder = new GsonBuilder();\nGson gson = builder.create();\n<!RootClassName> model = gson.fromJson(json, <!RootClassName>.class);\n```\n\n\n#### Encoding: \nThe example below shows how to encode an instance of a simple `<!RootClassName>` type into a JSON object.\n\n```java\n<!RootClassName> model = new <!RootClassName>();\n// Assign value to variables.\n\nGsonBuilder builder = new GsonBuilder();\nGson gson = builder.create();\nSystem.out.println(gson.toJson(model));\n```"
135136
}

0 commit comments

Comments
 (0)