Json Schema validation: do not allow fields other than those declared in schema [duplicate]

You can create a json-schema and use the option:

additionalProperties = false

That way you only allow the attributes defined in properties. In your case:

{
    "properties": {
        "fname": {"type": "string"},
        "lname": {"type": "string"},
        "age": {"type": "string"}
    },
    "additionalProperties": false
}