Skip to content

Commit 864b58b

Browse files
committed
New json_join()
1 parent ef36d15 commit 864b58b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

turbine/code/export/json.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ import python;
7171
(J, path));
7272
}
7373

74+
(string t) json_join(string J1, string J2)
75+
{
76+
t = python_persist("from turbine_helpers import *",
77+
"json_join('''%s''','''%s''')" % (J1, J2));
78+
}
79+
7480
// Encoders
7581

7682
(string o) json_arrayify(string text)

turbine/code/py/turbine_helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ def json_get(J, path):
102102
return "null"
103103
return str(J)
104104

105+
def json_join(J1, J2):
106+
J1 = json.loads(J1)
107+
J2 = json.loads(J2)
108+
return str(J1 | J2)
109+
105110

106111
### MPI4PY STUFF
107112

0 commit comments

Comments
 (0)