简体   繁体   中英

JSON Components to separate Data Frames in R

This is information parsed from resumes I have a JSON file like,

object {2}
   data {1}
     resume{100}
       1{23}
         name: value
         work{3}
              title: value
              start date: value  
              end date: value
              2{20}
          ...

and so on,

I would like to create separate data frames or separate rows in the same data frame in R for all the resumes,

R Data Frame ,
Columns: name, work.title, work.start_date,work.end_date 

Row1: Information from 1st resume in JSON file

Row2: Information from 2nd resume in JSON file

Any help is highly appreciated.

Thank you, Parth

As Jerome asked, here is sample of the json file
{"meta":{"status":200,"contentLocation":"http:\u002F\u002Fapi.indeed.com","sort":"date","q":"","v":"1","paging":{"current":"\u002Fresumes?client_id=5ae8db4a46efd1b2c207ae42746c0c8d8d93c43dd5bff7e4ae045004c0ab766e&useragent=DanLikesSeattle&v=1&l=19709&radius=40&sort=date&start=0&limit=100&pretty=0&rb=yoe%3A11-200","limit":100,"next":"\u002Fresumes?client_id=5ae8db4a46efd1b2c207ae42746c0c8d8d93c43dd5bff7e4ae045004c0ab766e&useragent=DanLikesSeattle&v=1&l=19709&radius=40&sort=date&start=100&limit=100&pretty=0&rb=yoe%3A11-200","start":0,"total":275879},"l":"19709","errors":{},"links":{"next":[{"href":"\u002Fresumes?client_id=5ae8db4a46efd1b2c207ae42746c0c8d8d93c43dd5bff7e4ae045004c0ab766e&useragent=DanLikesSeattle&v=1&l=19709&radius=40&sort=date&start=100&limit=100&pretty=0&rb=yoe%3A11-200","title":"Next Page"}],"up":[{"href":"\u002Fresumes","title":"Search Resumes"}]}},"data":{"resumes":[{"additionalInfo":"","awards":[],"certifications":[],"city":"Deptford, NJ","country":"US","dateCreated":{"displayDate":"February 9, 2015","granularity":"DAY","isoDate":"2015-02-09T06:00:00Z"},"dateModified":{"displayDate":"April 13, 2015","granularity":"DAY","isoDate":"2015-04-13T05:00:00Z"},"educations":[{"dateRange":{"displayDateRange":"2006 to 2007","endDate":{"displayDate":"2007","granularity":"YEAR","isoDate":"2007-01-01T06:00:00Z"},"startDate":{"displayDate":"2006","granularity":"YEAR","isoDate":"2006-01-01T06:00:00Z"}},"degree":"High School Diploma","field":"Technical","location":"Cape May Court House, NJ","school":"State of NJ"}],"firstName":"dummyfirstname","groups":[],"headline":"","lastName":"dummylastname","links":[],"location":{"admin1":"NJ","city":"Deptford","country":"US","formattedCity":"Deptford, NJ"},"militaryBackground":false,"militaryExperiences":[],"patents":[],"publications":[],"resumeKey":"6133565dfad7c519","skills":"Customer service, general labor\nWarehouse, delivery, salesman, \nInventory","summary":"","url":"\u002Fr\u002Fdummyfirstname-dummylastname\u002F6133565dfad7c519","workExperiences":[{"company":"Accu Staffing","dateRange":{"displayDateRange":"November 2013 to Present","startDate":{"displayDate":"November 2013","granularity":"MONTH","isoDate":"2013-11-01T05:00:00Z"}},"description":"Responsibilities\nWorked in two different warehouse mainly distribution of goods\n\nSkills Used\nCounting lifting sorting stacking labeling ","location":"Woodbury, NJ","title":"Warehouse Worker"},{"company":"wildwood linen","dateRange":{"displayDateRange":"May 2013 to December 2013","endDate":{"displayDate":"December 2013","granularity":"MONTH","isoDate":"2013-12-01T06:00:00Z"},"startDate":{"displayDate":"May 2013","granularity":"MONTH","isoDate":"2013-05-01T05:00:00Z"}},"description":"Responsibilities\nDelivered various goods to different companies in South Jersey area\n\nSkills Used\nCounting, inventory, customer service provider\nSalesman, ","location":"Wildwood, NJ","title":"Delivery Driver\u002FLaborer"},{"company":"earthtech","dateRange":{"displayDateRange":"September 2012 to February 2013","endDate":{"displayDate":"February 2013","granularity":"MONTH","isoDate":"2013-02-01T06:00:00Z"},"startDate":{"displayDate":"September 2012","granularity":"MONTH","isoDate":"2012-09-01T05:00:00Z"}},"description":"Responsibilities\nDelivered specific goods to different companies in the South Jersey area\n\nSkills Used\nInventory, customer service , mechanical skills,painting, welding tire repair","location":"Woodbine, NJ","title":"Delivery Driver\u002FWarehouse Worker"},{"company":"wildwood linen","dateRange":{"displayDateRange":"May 2007 to August 2012","endDate":{"displayDate":"August 2012","granularity":"MONTH","isoDate":"2012-08-01T05:00:00Z"},"startDate":{"displayDate":"May 2007","granularity":"MONTH","isoDate":"2007-05-01T05:00:00Z"}},"description":"Responsibilities\nDelivered different goods and services to various companies in the South Jersey area\n\nSkills Used\nCounting, inventory warehouse work, customer service provider, salesman","location":"Wildwood, NJ","title":"Deliver Driver"}]},{"additionalInfo":"","awards":[],"certifications":[],"city":"Newark, DE","country":"US","dateCreated":{"displayDate":"April 13, 2015","granularity":"DAY","isoDate":"2015-04-13T05:00:00Z"},"dateModified":{"displayDate":"April 13, 2015","granularity":"DAY","isoDate":"2015-04-13T05:00:00Z"},"educations":[{"dateRange":{"displayDateRange":"2014 to 2017","endDate":{"displayDate":"2017","granularity":"YEAR","isoDate":"2017-01-01T06:00:00Z"},"startDate":{"displayDate":"2014","granularity":"YEAR","isoDate":"2014-01-01T06:00:00Z"}},"degree":"Associates","field":"Paralegal Program","location":"Wilmington, DE","school":"Widener University"},{"dateRange":{"displayDateRange":"2008 to 2008","endDate":{"displayDate":"2008","granularity":"YEAR","isoDate":"2008-01-01T06:00:00Z"},"startDate":{"displayDate":"2008","granularity":"YEAR","isoDate":"2008-01-01T06:00:00Z"}},"degree":"Certificate Medical Billing & Coding","field":"Medical Billing & Coding","location":"Wilmington, DE","school":"Delaware Technical & Community College"},{"dateRange":{"displayDateRange":"2003 to 2008","endDate":{"displayDate":"2008","granularity":"YEAR","isoDate":"2008-01-01T06:00:00Z"},"startDate":{"displayDate":"2003","granularity":"YEAR","isoDate":"2003-01-01T06:00:00Z"}},"degree":"Associates","field":"Registered Nurse Program","location":"Wilmington, DE","school":"Delaware Technical Community College"}],"firstName":"dummyfirstname","groups":[],"headline":"Assignment as an Executive Administrative Assistant - Temporary Agencies","lastName":"dummyfirstname","links":[],"location":{"admin1":"DE","admin2":"003","city":"Newark","country":"US","formattedCity":"Newark, DE"},"militaryBackground":false,"militaryExperiences":[],"patents":[],"publications":[],"resumeKey":"86ae02b5d276fe1a","skills":"","summary":"","url":"\u002Fr\u002Fdummyfirstname-dummyfirstname\u002F86ae02b5d276fe1a","workExperiences":[{"company":"Swartz Campbell LLC","dateRange":{"displayDateRange":"2014 to 2015","endDate":{"displayDate":"2015","granularity":"YEAR","isoDate":"2015-01-01T06:00:00Z"},"startDate":{"displayDate":"2014","granularity":"YEAR","isoDate":"2014-01-01T06:00:00Z"}},"description":"Generated, printed and distributed bill drafts at month-end for assigned partners for their review\n• Made adjustments and edits in accordance with the partners' requests including narrative edits and transfers of time and costs\n• Processed approved write offs and prepared blended rate invoices when required\n• Prepared electronic bills in LEDES (Legal Electronic Data Exchange Standard) format using E-Billing Program\n• Submitted electronic bills to clients via their designated electronic billing systems; TyMetrix 360, Serengetti, Acuity, Counsel Link, Legal Exchange and several other sites\n• Submitted timekeepers and rates for approval as needed\n• Coordinated with colleagues and clients to resolve unsuccessful electronic bill submissions\n• Tracked status of all submissions; including identify issues and addressing rejections accordingly\n• Communicated within the firm, with clients, and with electronic billing service providers\n• Performed other tasks as necessary for successful operation of electronic billing","location":"Wilmington, DE","title":"Legal Billing Assistant"},{"company":"Various Agencies","dateRange":{"displayDateRange":"2012 to 2015","endDate":{"displayDate":"2015","granularity":"YEAR","isoDate":"2015-01-01T06:00:00Z"},"startDate":{"displayDate":"2012","granularity":"YEAR","isoDate":"2012-01-01T06:00:00Z"}},"description":"•\tAssignment as an Executive Administrative Assistant for a local Accounting Firm \n•\tAssignment as a Legal Assistant for a well-established law firm – Just Legal, Inc.\n•\tAssignment as a Medical Secretary \u002F Scheduler for a well-established OB\u002FGYN doctor’s office – AppleOne Staffing\n","location":"","title":"Temporary Agencies"},{"company":"Doroshow, Pasquale, Krawitz & Bhaya","dateRange":{"displayDateRange":"2009 to 2012","endDate":{"displayDate":"2012","granularity":"YEAR","isoDate":"2012-01-01T06:00:00Z"},"startDate":{"displayDate":"2009","granularity":"YEAR","isoDate":"2009-01-01T06:00:00Z"}},"description":"•Answered and transferred calls using a multi-line telephone system\n• Scheduled appointments for the attorneys and clients using Outlook calendar system\n• Scheduled hearings with the Industrial Accident Board\n• Scheduled Depositions, Mediations, Arbitrations and other various scheduling needs with coordinating opposing counsel and doctor offices.\n• Prepared litigation documents to coordinate with our group\n• Data entry using the software Time Matters","location":"Bear, DE","title":"Legal Secretary"},{"company":"Matt's Auto Repairs","dateRange":{"displayDateRange":"2006 to 2009","endDate":{"displayDate":"2009","granularity":"YEAR","isoDate":"2009-01-01T06:00:00Z"},"startDate":{"displayDate":"2006","granularity":"YEAR","isoDate":"2006-01-01T06:00:00Z"}},"description":"•\tAnswered and transferred calls using a multi-line telephone system\n•\tScheduled estimates and daily repairs\n•\tCreated estimates using Shop Keys and calling part warehouses for prices\n•\tCreated Excel spread sheets for Daily Revenue, and used the information to create reports for Bookkeeping purposes\n•\tBalanced the company checkbook and prepared weekly deposit\n•\tPrepared weekly payroll, payments for vendors, and parts warehouse \n•\tPrepared collection letters and followed through with collection calls\n•\tPrepared legal documents for DMV to take over ownership of vehicles\n•\tPicked up and sorted mail daily as well as order all office supplies\n","location":"New Castle, DE","title":"Administrative Assistant"}]}]}}

The jsonlite package does this automatically. For example:

library(jsonlite)
out <- fromJSON("http://pastebin.com/raw.php?i=Rash2Svf")

# Extract resumes
resumes <- out$data$resumes
names(resumes)

# Work experiences for candidate 1 
print(resumes[[1, "workExperiences"]])

# Educations for candidate 2
print(resumes[[2, "educations"]])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM