No sé si le servirá esto que subo. Es una prueba de concepto, yo uso un "Settings" en XML y estuve jugando con uno en JSON, está incompleto, solo realiza la lectura del fichero. A futuro quiero retomarlo, me pareció más sencillo que XML. He "limpiado" un poco el código para hacerlo más entendible.
La idea es tener dos ficheros de configuración, uno local y otro global. Permite parámetros de aplicación generales y particulares.
.
Código:
{"Global":
{"ConfigJSON":[
{"Database":[
{"key":1000, "name": "DBType", "type": "string", "value": "sqlite3"},
{"key":1001, "name": "DBCharset", "type": "string", "value": "UTF8"},
{"key":1002, "name": "DBHostName", "type": "string", "value": "PruebaLocal"},
{"key":1003, "name": "DBPort", "type": "integer", "value": "8000"},
{"key":1004, "name": "DBDatabase", "type": "string", "value": "ConfigJSON.sqlite"},
{"key":1005, "name": "DBUser", "type": "string", "value": null},
{"key":1006, "name": "DBPassword", "type": "string", "value": null}
]},
{"Mask":[
{"key":1100, "name": "MaskDate", "type": "string", "value": "dd/mm/yyyy"},
{"key":1101, "name": "MaskInteger", "type": "string", "value": "###0"},
{"key":1102, "name": "MaskFloat", "type": "string", "value": "#,##0.00"},
{"key":1103, "name": "MaskTime", "type": "string", "value": "hh:mm"},
{"key":1104, "name": "ComaDecimal", "type": "string", "value": ","},
{"key":1105, "name": "PuntoMiles", "type": "string", "value": "."},
{"key":1106, "name": "Decimales", "type": "integer", "value": "-2"},
{"key":1107, "name": "MaskMoney", "type": "string", "value": "$#,##0.00"}
]},
{"Company":[
{"key":9900, "name": "RazonSocial", "type": "string", "value": "Prueba S.L."},
{"key":9901, "name": "CIF", "type": "string", "value": "B00000000"},
{"key":9902, "name": "Direccion", "type": "string", "value": "Avenida de JSON 5"},
{"key":9903, "name": "Poblacion", "type": "string", "value": "JSON de Abajo"},
{"key":9904, "name": "CodigoPostal", "type": "string", "value": "99000"},
{"key":9905, "name": "Provincia", "type": "string", "value": "Republica de JSON"},
{"key":9906, "name": "Telefono", "type": "integer", "value": "999 999 999"},
{"key":9907, "name": "Movil", "type": "string", "value": null},
{"key":9950, "name": "Banco", "type": "string", "value": "El móvil es NULL"},
{"key":9951, "name": "Oficina", "type": "string", "value": null},
{"key":9952, "name": "Cuenta", "type": "string", "value": null},
{"key":9953, "name": "SWIF", "type": "string", "value": null}
]}
]}
}
Espero que le sirva.