no, there are no JSON parsing classes in painless, so this isn't possible.
But even if there were, it's not a good idea to use painless for this task. The way Kibana handles scripted fields is to calculate the value on the fly for each document you are querying for each request you are making. As JSON parsing is a relatively complex operation, this would put a lot of load on your cluster and make queries super slow, especially for larger data sets.
However you can do this kind of transformation during ingest, which means you only have to do the parsing once (when you are indexing the document), and all requests based on the parsed data will be very fast. This related question shows a way to do this with Logstash.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.