[GTALUG] Extracting data from JSON file

Aruna Hewapathirane aruna.hewapathirane at gmail.com
Mon Jul 22 20:41:16 EDT 2019


<snip>

> I'm writing automated test scripts.  Unfortunately for me, input
> configuration is XML, and I use "xmlstarlet" to get data from that.  The
> output is JSON, and I need to extract data from that to say "Pass" or
> "Fail".
>
<snip>

Hi William, I have attached 3 files. Put all 3 files in the same
folder/directory and
run using the terminal:

1 - python duplicates.py
2 - python duplicates2.py

The file 'duplicates.py' will detect duplicates in json passed in as a
'string'  form.

The file 'duplicates2.py' will detect duplicates read from a disk file ( in
this case the file william.json)

I have no idea how comfortable you are with python but do go through all 3
files. it
is not hard to understand. If you have questions please let me know. At
least this will help
you extract what you need.

Hope this helps - Aruna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20190722/38313706/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: william.json
Type: application/json
Size: 465 bytes
Desc: not available
URL: <http://gtalug.org/pipermail/talk/attachments/20190722/38313706/attachment.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: duplicates2.py
Type: text/x-python
Size: 491 bytes
Desc: not available
URL: <http://gtalug.org/pipermail/talk/attachments/20190722/38313706/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: duplicates.py
Type: text/x-python
Size: 922 bytes
Desc: not available
URL: <http://gtalug.org/pipermail/talk/attachments/20190722/38313706/attachment-0001.py>


More information about the talk mailing list