Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-2-2
Commits
35cb1ed0
Commit
35cb1ed0
authored
Sep 28, 2011
by
Rob Jonson
Committed by
Jean-Baptiste Kempf
Oct 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate properly escaped json
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
514b0244
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
48 deletions
+8
-48
share/lua/http/requests/browse.json
share/lua/http/requests/browse.json
+2
-3
share/lua/http/requests/playlist.json
share/lua/http/requests/playlist.json
+1
-3
share/lua/http/requests/status.json
share/lua/http/requests/status.json
+1
-3
share/lua/intf/modules/httprequests.lua
share/lua/intf/modules/httprequests.lua
+4
-39
No files found.
share/lua/http/requests/browse.json
View file @
35cb1ed0
...
@@ -33,8 +33,7 @@ httprequests.processcommands()
...
@@ -33,8 +33,7 @@ httprequests.processcommands()
local
browseTable=httprequests.getbrowsetable()
local
browseTable=httprequests.getbrowsetable()
print('
{
')
httprequests.printTableAsJson(browseTable)
httprequests.printTableAsJson(browseTable
,
0
)
print('
}
')
?>
?>
share/lua/http/requests/playlist.json
View file @
35cb1ed0
...
@@ -31,8 +31,6 @@ require "httprequests"
...
@@ -31,8 +31,6 @@ require "httprequests"
httprequests.processcommands()
httprequests.processcommands()
print('
{
')
httprequests.printTableAsJson(httprequests.playlisttable())
httprequests.printTableAsJson(httprequests.playlisttable()
,
0
)
print('
}
')
?>
?>
share/lua/http/requests/status.json
View file @
35cb1ed0
...
@@ -33,8 +33,6 @@ httprequests.processcommands()
...
@@ -33,8 +33,6 @@ httprequests.processcommands()
local
statusTable=httprequests.getstatus(
true
)
local
statusTable=httprequests.getstatus(
true
)
print('
{
')
httprequests.printTableAsJson(statusTable)
httprequests.printTableAsJson(statusTable
,
0
)
print('
}
')
?>
?>
share/lua/intf/modules/httprequests.lua
View file @
35cb1ed0
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
module
(
"httprequests"
,
package
.
seeall
)
module
(
"httprequests"
,
package
.
seeall
)
local
dkjson
=
require
(
"dkjson"
)
...
@@ -195,47 +196,11 @@ function xmlString(s)
...
@@ -195,47 +196,11 @@ function xmlString(s)
end
end
end
end
local
printJsonKeyValue
=
function
(
k
,
v
,
indent
)
print
(
"
\n
"
)
for
i
=
1
,
indent
do
print
(
" "
)
end
if
(
k
)
then
print
(
"
\"
"
..
k
..
"
\"
:"
)
end
if
(
type
(
v
)
==
"number"
)
then
print
(
xmlString
(
v
))
elseif
(
type
(
v
)
==
"table"
)
then
if
(
v
.
_array
==
NULL
)
then
print
(
"{\n"
)
printTableAsJson
(
v
,
indent
+
2
)
print
(
"
\n
}"
)
else
print
(
"["
)
printArrayAsJson
(
v
.
_array
,
indent
+
2
)
print
(
"
\n
]"
)
end
else
print
(
"
\"
"
..
xmlString
(
v
)
..
"
\"
"
)
end
end
printArrayAsJson
=
function
(
array
,
indent
)
first
=
true
for
i
,
v
in
ipairs
(
array
)
do
if
not
first
then
print
(
","
)
end
printJsonKeyValue
(
NULL
,
v
,
indent
)
first
=
false
end
end
printTableAsJson
=
function
(
dict
,
indent
)
printTableAsJson
=
function
(
dict
)
first
=
true
local
output
=
dkjson
.
encode
(
dict
,
{
indent
=
true
})
for
k
,
v
in
pairs
(
dict
)
do
print
(
output
)
if
not
first
then
print
(
","
)
end
printJsonKeyValue
(
k
,
v
,
indent
)
first
=
false
end
end
end
local
printXmlKeyValue
=
function
(
k
,
v
,
indent
)
local
printXmlKeyValue
=
function
(
k
,
v
,
indent
)
...
...
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