function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

No such method error when calling JSONObject.getInt

Hello all,


I'm using Ron Hess's JSONObject port and I'm having a strange issue. getString works fine, but trying to call getInt results in a compiler warning that says there is no such method. I can see perfectly well that JSONObject.cls has a public method called getInt which has the right signature, but the Apex compiler just doesn't seem to understand that!


Does anyone know what the problem might be?


let me brief both the method signatures once then it will be very clear..


Use 'optInt' instead 'getint'... might solve your problem.


Tried that, unfortunately I got the same error.


Have you looked into the JSON class? See if the code is not missing anything. Please post some code here and the error message too.