前回に引き続き連想配列の配列でつまずいたので覚え書きです。
とりあえずPHPで書くとこんなデータです。
php
$data = array(
'shcool' => '第一中央',
'class' => "3-2",
'number' => "21",
'testList' => ["数学","日本史"],
'find' => array(
'statement' => 'AND',
'statementList' => array([
'key' => '試験日',
'operator' => '>=',
'value' => '2020/05/15 00:00:00',
],[
'key' => '試験日',
'operator' => '<=',
'value' => '2020/05/15 23:59:59',
],),
),
'limit' => 5,
'select' => array([
'fieldName' => '問い3回答',
'returnName' => 'Q3 A'],
),
);
これをVBA-JSONで書くとこうなりました。
一部変数にして文字列結合しています。クォーテーションの数が凄いことになって混乱します。
vba
class = "3-2"
number = "21"
Dim param As Object
Set param = JsonConverter.ParseJson("{""shcool"":""第一中央""," & _
"""class"":""" & class & """," & _
"""number"":""" & number & """" & _
"""testList"":[""数学","日本史""]," & _
"""find"":{""statement"":""AND""," & _
"""statementList"":[{""key"":""試験日"",""operator"":"">\="",""value"":""2020/05/15 00:00:00""}," & _
"{""key"":""UPDATE_TIMESTAMP"",""operator"":""<\="",""value"":""2020/05/15 23:59:59""}]}" & _
"""limit"":5," & _
"""select"":[{""fieldName"":""問い3回答"",""returnName"":""Q3 A""}]" & _
"}")