小编Jac*_*ine的帖子

reading json file in pyspark

I'm new to PySpark, Below is my JSON file format from kafka.

{
        "header": {
        "platform":"atm",
        "version":"2.0"
       }
        "details":[
       {
        "abc":"3",
        "def":"4"
       },
       {
        "abc":"5",
        "def":"6"
       },
       {
        "abc":"7",
        "def":"8"
       }    
      ]
    }
Run Code Online (Sandbox Code Playgroud)

how can I read through the values of all "abc" "def" in details and add this is to a new list like this [(1,2),(3,4),(5,6),(7,8)]. The new list will be used to create a spark data frame. how can i do this in pyspark.I tried the below …

apache-spark spark-streaming pyspark

10
推荐指数
3
解决办法
6万
查看次数

标签 统计

apache-spark ×1

pyspark ×1

spark-streaming ×1