在处理数据库查询时如何模糊JSON响应?

[
 {
  "businesscards_id":"12",
  "X_SIZE":"1.75x3",
  "X_PAPER":"14ptGlossCoatedCoverwithUV(C2S)",
  "X_COLOR":"1002",
  "X_QTY":"250",
  "O_RC":"NO",
  "F_PRICE":"12490",
  "UPS_GROUND":"12000",
  "UPS_TWODAY":"24000",
  "UPS_OVERNIGHT":"36000"
 }
]

This JSON encode response is seen in console of Chrome. This array is being returned from a DB query. It is showing my table column names. For security reasons I do not want to show my table column names. How can this JSON object be obfuscated or hashed and/or encoded or dynamically re-written to keep my table col names private?

It really depends on how you wish to use the record once it has been received. One strategy might be to return an array of the values only, discarding the keys. Then in your code, use your private knowledge of which array value you need when you process the record. Something like:

var result=[];
Object.keys(record).forEach(function(key){result.push(record[key]);});

And then in your code, use array indices to access the values.

Don't do anything to your JSON.

If you don't want your column names to be visible, just dont use your column names. Create a new array using new keys to send with JSON and then change that array back into one containing your column names afterwards.

But it really shouldn't be a problem people seeing them. Nobody has access to your database so letting people see column names isn't an issue.

SQL statement:

SELECT `col_name` AS 'something_else'

But also, as everyone else said, don't do this for security. It is pointless.