Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to Json Utils to get values as Double,Int,String array #2678

Closed
1 of 2 tasks
shah-nirmit opened this issue Sep 21, 2023 · 3 comments
Closed
1 of 2 tasks
Labels
feature-request A feature should be added or improved. needs-review This issue or pull request needs review from a core team member. p3 This is a minor priority issue

Comments

@shah-nirmit
Copy link

Describe the feature

As a user I would like to parse json object that could have values like double arrays,int arrays or string arrays for a specific key
Take for an example a JSON object from

{
"embedding":[0.432442,-0.234342,.....]
"co-ordinates":[10.2423,4.432]
}

Use Case

This would be useful for consider a machine learning applications calling sagemaker endpoints. Which could return an inference which could contain embedding or other outputs in which a value can be an array.

Proposed Solution

One simple solution that comes to my mind is a method like this for JsonView Class

Array<double> JsonView::GetDoubleArray(const Aws::String& key) const
{
    assert(m_value);
    auto array = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str());
    assert(cJSON_AS4CPP_IsArray(array));
    Array<double> returnArray(cJSON_AS4CPP_GetArraySize(array));

    auto element = array->child;
    for (unsigned i = 0; element && i < returnArray.GetLength(); ++i, element = element->next)
    {
        returnArray[i] = element->valuedouble;
    }

    return returnArray;
}

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@shah-nirmit shah-nirmit added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Sep 21, 2023
@jmklix
Copy link
Member

jmklix commented Sep 22, 2023

Looking into if we want to add this feature

@jmklix jmklix added p3 This is a minor priority issue needs-review This issue or pull request needs review from a core team member. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 22, 2023
@jmklix
Copy link
Member

jmklix commented Oct 3, 2023

Sorry, but this is not a feature that we are currently planning on adding to the base sdk. Closing this feature request

@jmklix jmklix closed this as completed Oct 3, 2023
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. needs-review This issue or pull request needs review from a core team member. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

2 participants