Support Questions
Find answers, ask questions, and share your expertise

Nifi : Nested JSON records schema validation

Nifi : Nested JSON records schema validation

New Contributor

I'm trying to split a JSON file containing nested records using the SplitRecord processor.


As a result, I always get a null value instead of the expected array of records:


{"userid":"xxx","bookmarks":null}


Below is sample JSON

{
  "_id": {
    "oid": "5715fd7dc6b491db15a4243b"
  },
  "bookmarks": [
    {
      "_id": {
        "oid": "577d676eca6baf40f15d9c91"
      },
      "id": "10000XXXXXXW0007760",
      "creator": "player",
      "position": 42.96,
      "creationdate": {
        "date": "2016-05-27T19:19:02.379Z"
      }
    },
    {
      "_id": {
        "oid": "577d676eca6baf40f15d9c94"
      },
      "id": "ALIGXXXXXXXW0007944",
      "creator": "player",
      "position": 95.06,
      "creationdate": {
        "date": "2016-03-31T15:07:29.654Z"
      }
    }
  ],
  "lastaction": {
    "date": "2019-07-24T12:13:27.388Z"
  },
  "settings": {
    "preferredlanguage": "vost",
    "preferredvideoquality": "hd"
  },
  "userid": "xxxx",
  "maskedcontents": [
    
  ]
}
	

Avro Schema:

{
	"namespace": "nifi",
	"name": "bookmark",
	"type": "record",
	"fields": [
		{ "name": "userid", "type": "string" },
		{ "name": "bookmarks", "type": {
			"type": "record",
			"name": "bookmarks",
				"fields": [
					{ "name": "id", "type": "string" },
					{ "name": "creator", "type": "string" },
					{ "name": "position", "type": "float" }
				]
			}
		}
	]
}


	

Any help would be greatly appreciated !