Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zzha zzha
OpenXG-RAN
Commits
3b282d7f
Commit
3b282d7f
authored
Apr 22, 2022
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix json format in log response
parent
80bf0358
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
common/utils/websrv/websrv.c
common/utils/websrv/websrv.c
+4
-2
No files found.
common/utils/websrv/websrv.c
View file @
3b282d7f
...
@@ -147,7 +147,8 @@ void websrv_printf_end(int httpstatus ) {
...
@@ -147,7 +147,8 @@ void websrv_printf_end(int httpstatus ) {
/*--------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------*/
/* format a json response from a result table returned from a call to a telnet server command */
/* format a json response from a result table returned from a call to a telnet server command */
void
websrv_getdata_response
(
struct
_u_response
*
response
,
webdatadef_t
*
wdata
)
{
void
websrv_getdata_response
(
struct
_u_response
*
response
,
webdatadef_t
*
wdata
)
{
json_t
*
jbody
=
json_array
();
json_t
*
jdata
=
json_array
();
for
(
int
i
=
0
;
i
<
wdata
->
numlines
;
i
++
)
{
for
(
int
i
=
0
;
i
<
wdata
->
numlines
;
i
++
)
{
json_t
*
kv
=
json_object
();
json_t
*
kv
=
json_object
();
for
(
int
j
=
0
;
j
<
wdata
->
numcols
;
j
++
)
{
for
(
int
j
=
0
;
j
<
wdata
->
numcols
;
j
++
)
{
...
@@ -162,8 +163,9 @@ void websrv_getdata_response(struct _u_response * response,webdatadef_t * wdata)
...
@@ -162,8 +163,9 @@ void websrv_getdata_response(struct _u_response * response,webdatadef_t * wdata)
jval
=
json_integer
((
int
)(
wdata
->
lines
[
i
].
val
[
j
]));
jval
=
json_integer
((
int
)(
wdata
->
lines
[
i
].
val
[
j
]));
json_object_set_new
(
kv
,
wdata
->
columns
[
j
].
coltitle
,
jval
);
json_object_set_new
(
kv
,
wdata
->
columns
[
j
].
coltitle
,
jval
);
}
}
json_array_append_new
(
j
body
,
kv
);
json_array_append_new
(
j
data
,
kv
);
}
}
json_t
*
jbody
=
json_pack
(
"{s:o,s:o}"
,
"display"
,
json_string
(
""
),
"logs"
,
jdata
);
websrv_jbody
(
response
,
jbody
);
websrv_jbody
(
response
,
jbody
);
}
}
/*----------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment