<div dir="ltr"><div>Hi Sui,<div><br><div>I think I've written out JSON format files (very simple ones) in NCL, but I haven't read them in. I should also mention I'm not an expert in the JSON format.</div><div><br></div><div>I would think you would need to do something like the following:</div><div>1. Read in using asciiread as type string (<a href="http://www.ncl.ucar.edu/Applications/read_ascii.shtml">http://www.ncl.ucar.edu/Applications/read_ascii.shtml</a>).<br></div><div>2. 

Use the str_index_of_substr function to find all the positions for opening curly braces '{' and all the closing 'curly braces '}'.  <br></div><div>3. Start at the first position in the 'open_curly_brace' index and the last position in the 'close_curly_brace' index. </div><div>4. Check whether any curly braces are found within. </div><div>       Check whether any semicolons are found within.</div><div>            If so, read in the key:value pair.</div><div>       If not, check whether any commas are found within.</div><div>             If so, read in the array. </div><div>             If not, read in the value.</div><div><br></div><div>If you know the structure of what you'll be reading in advance, then it might not be too hard. If you want NCL to read any possible generalized JSON, this might be a hard task. </div><div><br></div><div>Best,</div><div>Jonathan</div></div></div><div><br></div><div><br></div><div><br></div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><pre><font face="arial, helvetica, sans-serif">Jonathan Vigh                                               
Project Scientist I, Joint Numerical Testbed     
Research Applications Laboratory (RAL)
National Center for Atmospheric Research (NCAR)
P.O. Box 3000                    tel: +1 (303) 497-8205
Boulder, CO 80307-3000   fax: +1 (303) 497-8171
</font><font face="arial, sans-serif"><a href="http://www.ral.ucar.edu/staff/jvigh/" target="_blank">Jonathan's Staff Web Page</a> (CV, publications, etc.)
<a href="http://hurricanes.ral.ucar.edu/" target="_blank">Tropical Cyclone Guidance Project</a> (real-time hurricane data)</font></pre><pre><font face="arial, sans-serif"><a href="https://verif.rap.ucar.edu/tcdata/" target="_blank">Tropical Cyclone Data Project</a> (FLIGHT+, VDM+, TC-OBS datasets)</font></pre><pre><font face="arial, sans-serif"><a href="https://wxrisk.ucar.edu" target="_blank">Hurricane Risk Calculator</a> (personalizing hurricane risk assessments for evacuation decision support)</font></pre><pre><span style="color:rgb(136,136,136);font-family:Arial,Helvetica,sans-serif;white-space:normal">During COVID-19, my working day is definitely not the same as your working day. Please do not feel obliged to reply to this email outside of your normal working hours.</span><br></pre>
</div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 9, 2020 at 7:17 PM Rick Brownrigg via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi, <br></div><div><br></div><div>NCL has no built in functionality for reading JSON directly. In principle, you could parse the JSON using NCL's various string functions, but in practise, I think that would be extremely tedious.<br></div><div><br></div><div>Rick<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 9, 2020 at 6:23 PM 时光足迹 via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hi there, I wonder how to deal with JSON files with NCL(NCAR COMMAND LANGUAGE), thank you a lot!<br></div>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>