I believe you could use JOLT (bazaarvoice/jolt) to flatten it to a json string 
and then to dataframe or dataset.


| 
| 
| 
|  |  |

 |

 |
| 
|  | 
bazaarvoice/jolt

jolt - JSON to JSON transformation library written in Java.
 |

 |

 |





On Monday, July 17, 2017, 11:18:24 PM PDT, Chetan Khatri 
<chetan.opensou...@gmail.com> wrote:

Explode is not working in this scenario with error - string cannot be used in 
explore either array or map in spark
On Tue, Jul 18, 2017 at 11:39 AM, 刘虓 <ipf...@gmail.com> wrote:

Hi,have you tried to use explode?
Chetan Khatri <chetan.opensou...@gmail.com> 于2017年7月18日 周二下午2:06写道:

Hello Spark Dev's,
Can you please guide me, how to flatten JSON to multiple columns in Spark.
Example:

| Sr No | Title | ISBN | Info |
| 1 | Calculus Theory | 1234567890 | [{"cert":[{
"authSbmtr":"009415da-c8cd- 418d-869e-0a19601d79fa",
009415da-c8cd-418d-869e- 0a19601d79fa
"certUUID":"03ea5a1a-5530- 4fa3-8871-9d1ebac627c4",
"effDt":"2016-05-06T15:04:56. 279Z",
"fileFmt":"rjrCsv","status":" live"}],

"expdCnt":"15",
"mfgAcctNum":"531093",
"oUUID":"23d07397-4fbe-4897- 8a18-b79c9f64726c",
"pgmRole":["RETAILER"],
"pgmUUID":"1cb5dd63-817a-45bc- a15c-5660e4accd63",
"regUUID":"cc1bd898-657d-40dc- af5d-4bf1569a1cc4",
"rtlrsSbmtd":["009415da-c8cd- 418d-869e-0a19601d79fa"]}]
 |


I want to get single row with 11 columns.
Thanks.


Reply via email to