amnaredo / test

0 stars 0 forks source link

how about , field exists method #222

Open amnaredo opened 2 years ago

amnaredo commented 2 years ago

This is not an issue, but thinking how about adding json("username").exists instead of throwing NoSuchElement. Or donno if json("username").strOpt will return Option[String], this can lead to numOpt etc.,

btw., thanks for adding json("isPresent").bool, I was using my own implicit method to acheive it. ID: 224 Original Author: rajeshpv

amnaredo commented 2 years ago

@lihaoyi what was the resolution of this? WillNotFix or something else? I also would appreciate this and would be willing to try and implement it if necessary. Original Author: joshlemer

amnaredo commented 2 years ago

Also keen to understand why this has been closed, and what the recommended approach to check for presence is? Original Author: tekumara

amnaredo commented 2 years ago

questions go in the gitter channel Original Author: lihaoyi

amnaredo commented 2 years ago

Thanks, will direct further questions there! For others who might end up here, one way to do this is obj.value.contains("FieldName") where obj is a ujson.Obj Original Author: tekumara