Merge branch 'master' into concurrent_httpd
- Updated JSON parser library - Removed obsolete calls on json parser library.
This commit is contained in:
@@ -29,23 +29,27 @@ feature -- Implementation
|
||||
local
|
||||
o: JSON_OBJECT
|
||||
do
|
||||
create Result.make_array
|
||||
create Result.make_empty
|
||||
across
|
||||
list as c
|
||||
loop
|
||||
if attached {STRING} c.item.item (1) as value and attached {STRING} c.item.item (3) as img and attached {STRING} c.item.item (2) as company then
|
||||
if
|
||||
attached c.item.value as value and
|
||||
attached c.item.img as img and
|
||||
attached c.item.company as company
|
||||
then
|
||||
if value.as_lower.has_substring (input.as_lower) then
|
||||
create o.make
|
||||
o.put (create {JSON_STRING}.make_json (img), "img")
|
||||
o.put (create {JSON_STRING}.make_json (value), "value")
|
||||
o.put (create {JSON_STRING}.make_json (company), "company")
|
||||
o.put (create {JSON_STRING}.make_from_string (img), "img")
|
||||
o.put (create {JSON_STRING}.make_from_string (value), "value")
|
||||
o.put (create {JSON_STRING}.make_from_string (company), "company")
|
||||
Result.add (o)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
list: ITERABLE [TUPLE [STRING, STRING]]
|
||||
list: ITERABLE [TUPLE [value: STRING; company: STRING; img: STRING]]
|
||||
-- List of contacts
|
||||
|
||||
end
|
||||
|
||||
@@ -132,7 +132,7 @@ feature -- Implementation
|
||||
["ZM", {STRING_32} "Zambia"], ["ZW", {STRING_32} "Zimbabwe"]
|
||||
>>
|
||||
|
||||
create Result.make_array
|
||||
create Result.make_empty
|
||||
across
|
||||
list as c
|
||||
loop
|
||||
@@ -142,8 +142,8 @@ feature -- Implementation
|
||||
then
|
||||
if second.as_lower.has_substring (input.as_lower) then
|
||||
create o.make
|
||||
o.put (create {JSON_STRING}.make_json (first.as_lower), "flag")
|
||||
o.put (create {JSON_STRING}.make_json_from_string_32 (second), "value")
|
||||
o.put (create {JSON_STRING}.make_from_string (first.as_lower), "flag")
|
||||
o.put (create {JSON_STRING}.make_from_string_32 (second), "value")
|
||||
Result.add (o)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,11 +43,13 @@ feature -- Implementation
|
||||
if attached sess.get ("/complete/search?client=chrome", ctx) as resp and then not resp.error_occurred then
|
||||
l_json := resp.body
|
||||
end
|
||||
create Result.make_array
|
||||
create Result.make_empty
|
||||
if l_json /= Void and then not l_json.is_empty then
|
||||
create json_parser.make_parser (l_json)
|
||||
create json_parser.make_with_string (l_json)
|
||||
json_parser.parse_content
|
||||
if
|
||||
attached {JSON_ARRAY} json_parser.parse_json as data and then
|
||||
json_parser.is_valid and then
|
||||
attached {JSON_ARRAY} json_parser.parsed_json_value as data and then
|
||||
data.valid_index (2) and then
|
||||
attached {JSON_ARRAY} data.i_th (2) as list
|
||||
then
|
||||
@@ -56,7 +58,7 @@ feature -- Implementation
|
||||
loop
|
||||
if attached {JSON_STRING} list.i_th (c.item) as row then
|
||||
create o.make
|
||||
o.put (create {JSON_STRING}.make_with_escaped_json (row.item), "value")
|
||||
o.put (create {JSON_STRING}.make_from_escaped_json_string (row.item), "value")
|
||||
Result.add (o)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,8 +72,12 @@ feature -- Access
|
||||
end
|
||||
end
|
||||
if l_json /= Void and then not l_json.is_empty then
|
||||
create json_parser.make_parser (l_json)
|
||||
if attached {JSON_OBJECT} json_parser.parse_json as sp then
|
||||
create json_parser.make_with_string (l_json)
|
||||
json_parser.parse_content
|
||||
if
|
||||
json_parser.is_valid and then
|
||||
attached {JSON_OBJECT} json_parser.parsed_json_value as sp
|
||||
then
|
||||
if
|
||||
attached {JSON_OBJECT} sp.item ("responseData") as responsedata and then
|
||||
attached {JSON_ARRAY} responsedata.item ("results") as results
|
||||
|
||||
@@ -17,7 +17,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
control: detachable WSF_PROGRESS_CONTROL
|
||||
|
||||
make ()
|
||||
make
|
||||
do
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user