We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de16550 commit 70390d1Copy full SHA for 70390d1
README.md
@@ -26,6 +26,29 @@ JSON.json([2,3])
26
# "[2,3]"
27
JSON.json(j)
28
# "{\"an_array\":[\"string\",9],\"a_number\":5.0}"
29
+
30
+# import from a file called employees.json,
31
+# the contents of which are below,
32
+# manipulate, and write to another file
33
+# [
34
+# {
35
+# "id" : 1,
36
+# "salary" : 70000
37
+# },
38
39
+# "id" : 2,
40
+# "salary" : 80000
41
+# }
42
+# ]
43
+employees = JSON.parsefile("employees.json")
44
45
+for employee in employees
46
+ employee["salary"] = employee["salary"] * 2
47
+end
48
49
+open("employees_doubled.json", "w") do f
50
+ JSON.print(f, employees, 4)
51
52
```
53
54
## Documentation
0 commit comments