0

I can't seem to access an item 0: Watch Experession .

I have tried a number of different ways to access ComID, such as:

 ComID = response.Result.PartData.PartList.PartDto.Item(0).ComID  OR
 ComID = response.Result.PartData.PartList.PartDto.(0).ComID      OR
 ComID = response.Result.PartData.PartList.PartDto.0.ComID

This works all the way up to PartDto, but I'm just struggling to access Item 0.

My backup solution is to loop through each item in PartDto, which can work, but there's got to be a better way.

Thanks for your help!

9
  • 1
    If you're drilling into a series of nested dictionaries or collections wouldn't each have to be referenced as an item of the parent like you are referencing item(key 0)? Commented Jul 11, 2018 at 22:52
  • You should apply some context to your post. I'm assuming that response is responseText which is a JSON string converted by a library. My answer to Using VBA and VBA-JSON to access JSON data from Wordpress API would probably work. Commented Jul 11, 2018 at 22:55
  • 1
    @TinMan I'm not a VBA expert, so thanks for your patience. I have tried: ComID = response.Result.PartData.PartList.PartDto(1).ComID and ComID = response.Result.PartData.PartList.PartDto.Keys()(1).ComID and neither of those worked. Commented Jul 11, 2018 at 23:17
  • @Jeeped asked that question. You should review my post. What does TypeName(response.Result.PartData.PartList.PartDto) return? Commented Jul 11, 2018 at 23:22
  • @TinMan "JScriptTypeInfo" Commented Jul 11, 2018 at 23:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.