java - JSON Unrecognized character escape ':' -
good day,
i doing post
of json property follows:
{"db.url":"jdbc\:derby\:c\:\\users\\sasha\\unicentaopos-database;create\=true"}
and getting exception: unrecognized character escape ':' (code 58)\n @ [source: java.io.stringreader@358b85c8; line: 1, column: 480]
now, guess need replace \
\\
, whenever that:
jsonstring = jsonstring.replaceall("\\", "\\\\");
i exception:
exception in thread "awt-eventqueue-0" java.util.regex.patternsyntaxexception: unexpected internal error near index 1 \ ^ @ java.util.regex.pattern.error(pattern.java:1955) @ java.util.regex.pattern.compile(pattern.java:1702) @ java.util.regex.pattern.<init>(pattern.java:1351) @ java.util.regex.pattern.compile(pattern.java:1028) @ java.lang.string.replaceall(string.java:2223) @ com.openbravo.pos.forms.appconfig.convertconfigtojson(appconfig.java:332) @ com.openbravo.pos.forms.appconfig.load(appconfig.java:221) @ com.openbravo.pos.forms.appconfig.init(appconfig.java:141) @ com.openbravo.pos.forms.appconfig.<init>(appconfig.java:70) @ com.openbravo.pos.forms.appconfig.getappconfig(appconfig.java:78) @ com.openbravo.pos.forms.startpos$1.run(startpos.java:99) @ java.awt.event.invocationevent.dispatch(invocationevent.java:311) @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:756) @ java.awt.eventqueue.access$500(eventqueue.java:97) @ java.awt.eventqueue$3.run(eventqueue.java:709) @ java.awt.eventqueue$3.run(eventqueue.java:703) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:76) @ java.awt.eventqueue.dispatchevent(eventqueue.java:726) @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:201) @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:116) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:105) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:101) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:93) @ java.awt.eventdispatchthread.run(eventdispatchthread.java:82)
how deal it? highly appreciated.
in properties files must escape =
, :
in raw java not need to.
the correct escaping (i believe) should be:
"jdbc:derby:c:\\users\\sasha\\unicentaopos-database;create=true"
i.e. need esacpe \
(and "
if there any).
Comments
Post a Comment