config_loader.asp 543 B

123456789101112131415161718192021
  1. <%
  2. Set json = new ASPJson
  3. Set fso = Server.CreateObject("Scripting.FileSystemObject")
  4. Set stream = Server.CreateObject("ADODB.Stream")
  5. stream.Open()
  6. stream.Charset = "UTF-8"
  7. stream.LoadFromFile Server.MapPath( "config.json" )
  8. content = stream.ReadText()
  9. Set commentPattern = new RegExp
  10. commentPattern.Multiline = true
  11. commentPattern.Pattern = "/\*[\s\S]+?\*/"
  12. commentPattern.Global = true
  13. content = commentPattern.Replace(content, "")
  14. json.loadJSON( content )
  15. Set config = json.data
  16. %>