Tshark allows you to convert Pcap files to Json with -T ek. With -e you can decide what information you want to be included in the Json file.

tshark -T ek -e dns.qry.name -e dns.flags.rcode -x -r > $OUT