I have several similar JSON structures that I want to write to an SQL table for logging. However, some of the JSON fields contain sensitive information that I want to partially defer, so the full value is not displayed in the log.
Here is an example of one of the JSON structures:
{
"Vault": 1,
"Transaction": {
"gateway": {
"Login": "Nick",
"Password": "Password"
},
"credit_card": {
"number": "4111111111111"
}
}
}
In this case, I am trying to change the credit card number 4111so that it looks like 4xxx1111in JSON. I use Newtonsoft and deserialize JSON in JObject, but I am fixated on how to mask the value. I think the key is to something with JToken, but have not yet understood. I would like to make this solution as general as possible so that it works with any JSON structure that I would need to log out of the system.
.