It is not entierly clear what you want to do if any value is greater than a MAX limit.
Here is a demo that should get you started...
[{"id":"2e4caea4.70f522","type":"inject","z":"553814a2.1248ec","name":"BAD MQTT data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"1\": { \"x\": 5.4, \"y\": 12.5 }, \"2\": { \"x\": 20.0, \"y\": 1.2 } }","payloadType":"json","x":900,"y":1800,"wires":[["2cac272b.7b8218"]]},{"id":"31dbcf3c.b18cd","type":"debug","z":"553814a2.1248ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1260,"y":1820,"wires":[]},{"id":"2cac272b.7b8218","type":"function","z":"553814a2.1248ec","name":"","func":"\nconst MAX_X = 10;\nconst MAX_Y = 10;\nvar data = msg.payload;\nvar entries = Object.entries(data);\nvar err = false;\nfor (let index = 0; index < entries.length; index++) {\n const el = entries[index];\n let key = el[0];\n let item = el[1];\n if (item.x > MAX_X) {\n node.error(`item ${key} x is greater than ${MAX_X}`, msg);\n err = true;\n }\n if (item.y > MAX_Y) {\n node.error(`item ${key} y is greater than ${MAX_Y}`, msg);\n err = true;\n }\n}\n\nif (!err) return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":1820,"wires":[["31dbcf3c.b18cd"]]},{"id":"58fe94ec.b832bc","type":"inject","z":"553814a2.1248ec","name":"OK MQTT data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"1\":{\"x\":5.4,\"y\":7.5},\"2\":{\"x\":9,\"y\":1.2}}","payloadType":"json","x":900,"y":1840,"wires":[["2cac272b.7b8218"]]}]
example output...