Invalid JSON generated with rpc.get_config(options={'format': 'json'})
See original GitHub issue>>>json.loads(dev.rpc.get_config(options={'format': 'json'}).text)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.5/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 22030 column 17 (char 680605)
Looking at the json from dev.rpc.get_config(options={'format': 'json'}).text it indeed is missing a ,:
22021 "protocols" : [
22022 {
22023 "comment" : "BEGIN: ROUTING-INSTANCES",
22024 "bgp" : [
22025 {
22026 "apply-groups" : [
22027 {
22028 "data" : "BGP_DEFAULTS"
22029 }
22030 ]
22031 "path-selection" : [
22032 {
22033 "always-compare-med" : [
22034 {
22035 "data" : null
22036 }
22037 ]
22038 }
22039 ],
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Android Json RPC to pysjonrpc throws invalid JSON response
I am developing an android app which connects a python server through JSON. I am now encountering a bug that hinders the connection...
Read more >HH110: Invalid JSON-RPC response received: missing token ...
When I run yarn hardhat run scripts/deploy.js --network goerli , the following error is displayed in my terminal: HardhatError: HH110: Invalid ...
Read more >How to Fix the Invalid JSON Response Error in WordPress
Go to Settings → Permalinks in your WordPress dashboard and click Save Changes. This will force WordPress to generate a new, clean .htaccess ......
Read more >Solved: REST API / Invalid JSON Request
I dont get what there is been missing or where the error is? I didnt find anything through researches. Am I Missing the...
Read more >Understanding the Request Procedure in a NETCONF Session
<rpc> < operational-request format="(ascii | json | json-minified | text | xml ... Operational command RPCs also support returning XML output in minified ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @CMeza99
Thanks for reporting. This appears to be a Junos bug in the rendering of the configuration in JSON format. If you want to provide more details here I can help in tracking the Junos issue. Alternatively, you can open a JTAC case.
I would need to know:
show configuration | display xmlshow configuration | display jsonFYI, you should not have to call
json.loads()on the text of the RPC reply. Instead, when you request JSON format, PyEZ should perform thejson.loads()for you and return a native Python data structure.In this case, that’s not happening because the
json.loads()is raising an exception because the JSON emitted by Junos is invalid. I spoke with @vnitinv about this and he will address this specific PyEZ issue.The primary problem in this issue is a Junos bug. The user is addressing the Junos bug through JTAC.
The secondary problem is that the PyEZ behavior for this error condition was confusing and unexpected. This secondary problem has been addressed through #706.