If you need a list of wifi networks for your application then maybe this is useful for you. This solution makes use of the wpa_cli and then uses awk to format it.
sudo wpa_cli -i wlan0 scan 1>/dev/null; sleep 1; sudo wpa_cli -i wlan0 scan_results | awk 'BEGIN{ORS=""; print "["}; NR>1 {ORS=","; print "{\"signal\":"$3",\"ssid\":\""$5"\"}" }; END{ORS=""; print "]"}'
This command can be used in a shell. Either from your app or command line. The result goes to stdout you can either redirect it to a file or work with it directly.