-6

my file saved as json , it doesn't read it in . I don't mind if you want to convert it to text

{
  "startAt": 0,
  "maxResults": 0,
  "total": 505,
  "issues": [
    
  ]
}

All I want to do is extract number 505, its always after total :

import pandas as pd 
import json 


l=pd.read_json(r'C:\Users\ab006qj.D_ABSA\Desktop\JIRA\Number of Fields.json')

print(l['total'])

its returns 
Series([], Name: total, dtype: int64)
Osadhi Virochana
  • 1,294
  • 2
  • 11
  • 21
  • 1
    We don't write code for you, you need to post your code & we will try to fix your faults – Ajay A Jul 13 '20 at 06:07
  • This question does not follow the standards on stackoverflow. You can't ask people to write code for you. What have you tried, what is not working? What were your research efforts? – alt-f4 Jul 13 '20 at 06:07
  • You know its json, you are using python, you want to parse some data out of it. How hard can it be to type `parse json in python` into the search bar? – Boris Lipschitz Jul 13 '20 at 06:09
  • Sorry my first question on stack overflow , i added my code – Yusuf Rawat Jul 13 '20 at 06:38

1 Answers1

0
import pandas as pd 
import json 


#l=pd.read_json(r'C:\Users\ab006qj.D_ABSA\Desktop\JIRA\Number of Fields.json')
file_name = r'C:\Users\ab006qj.D_ABSA\Desktop\JIRA\Number of Fields.json'
with open(file_name, 'r') as f:
    document =  json.loads(f.read())

print(document['total'])
sumixam
  • 77
  • 1
  • 8