0

I am printing value of scala Map in Java class like below

Option<Object> data = JSON.parseFull((String)zkClient.readData(statePath));    
scala.collection.immutable.Map<String, Object> leaderInfo = scala.collection.immutable.Map<String, Object>) data.get();
    System.out.println(leaderInfo.toString();

But I am surprised that sometimes the value comes as floating point number

controller_epoch -> 6.0, leader -> 1.0, version -> 1.0, leader_epoch -> 4.0, isr -> List(1.0)

and sometimes as Integer.

controller_epoch -> 6, leader -> 1, version -> 1, leader_epoch -> 4, isr -> List(1)

I want the data to be always parsed as Integer. Is there any way to do that?

zer0Id0l
  • 1,374
  • 4
  • 22
  • 36
  • I think this is a duplication of http://stackoverflow.com/questions/18945949/is-it-possible-to-make-scalas-json-parsefull-not-to-treat-integers-as-decimal Set JSON.globalNumberParser. – Naetmul Jul 29 '14 at 01:09
  • Got it .. couldn't find it in search before. – zer0Id0l Jul 29 '14 at 01:11

0 Answers0