newline-delimited JSON to excel文件使用php

时间:2015-10-26 10:51:37

标签: php json mixpanel

从mixpanel API我得到newline-delimited JSON作为响应。我需要将此信息存储在excel文件中,或者如何将此json响应转换为单个有效的json。如何使用PHP。任何人请建议

这是mixpanel的回应

{"event":"Login","properties":{"time":1445803474,"distinct_id":"601","$browser":"Chrome","$browser_version":46,"$city":"cityname","$current_url":"http://localhost","$initial_referrer":"$direct","$initial_referring_domain":"$direct","$lib_version":"2.7.1","$os":"Windows","$region":"Region name","$screen_height":768,"$screen_width":1366,"mp_country_code":"countrycode","mp_lib":"web","userName":"local@gmail.com"}} 
{"event":"game","properties":{"time":1445803562,"distinct_id":"602","$browser":"Chrome","$browser_version":46,"$city":"cityname","$current_url":"http://localhost","$initial_referrer":"$direct","$initial_referring_domain":"$direct","$lib_version":"2.7.1","$os":"Windows","$region":"Region name","$screen_height":768,"$screen_width":1366,"mp_country_code":"countrycode","mp_lib":"web","userName":"local1@gmail.com"}}

1 个答案:

答案 0 :(得分:0)

由于您要求使用PHP ...文档中提出了一个PHP客户端:https://mixpanel.com/docs/api-documentation/data-export-api#libs-php