0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【VBA-JSON】連想配列の配列の書き方

Posted at

前回に引き続き連想配列の配列でつまずいたので覚え書きです。

とりあえず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""}]" & _
"}")
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?