testfor lapis lazuli anywhere in inventory

testfor @a {Inventory:{[Id:"minecraft:dye,Damage:4,Count:1"]}}

Inventory is a list of compound tags - [{...},{...},{...},{...}]. Currently you've got it as a compound tag with a list inside without a key, when everything inside a compound tag requires a key.

Fix that to get:

testfor @a {Inventory:[{Id:"minecraft:dye,Damage:4,Count:1"}]}

Next, id needs a lowercase i, and its string should just be the item ID; Damage and Count are separate tags:

testfor @a {Inventory:[{id:"minecraft:dye",Damage:4,Count:1}]}

Finally, Damage and Count are a short and a byte respectively, rather than both integers. This will be auto-corrected when setting them, but for testing you'll need to specify their type.

The full fixed command should be:

testfor @a {Inventory:[{id:"minecraft:dye",Damage:4s,Count:1b}]}