МОЙ КОД предпочтителен в scala для сглаживания множественных json
**val data = sc.textFile("/user/cloudera/spark/sample.json")
val nospace = data.map(x => x.trim())
val nospaces = nospace.filter(x => x!="")
val local = nospaces.collect
var vline =""
var eline :List[String]= List()
var lcnt =0
var rcnt =0
local.map{x =>
vline+=x
if (x=="[") lcnt+=1
if (x=="[") rcnt+=1
if (lcnt==rcnt){
eline++=List(vline)
lcnt=0
rcnt=0
vline =""
}
}**
MY Input Sheet multiple json file:
[
{
“Year”: “2013”,
“First Name”: “JANE”,
“County”: “A”,
“Sex”: “F”,
“Count”: “27”
},{
“Year”: “2013”,
“First Name”: “JADE”,
“County”: “B”,
“Sex”: “M”,
“Count”: “26”
},{
“Year”: “2013”,
“First Name”: “JAMES”,
“County”: “C”,
“Sex”: “M”,
“Count”: “21”
}
]