x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

JsonObject Parse Int64

I'm curious if there are any workarounds for getting int64 values from a JsonObject short of passing/parsing it as a string. I would like to use TryGetNumberField() but for the meanwhile I am just using GetIntegerField() and parsing it as an int32.

I am getting Unix times from the JSON for now so it's not the biggest issue but I would like to make the code future-proof and use one of the "try" functions instead for the return value.

Are there any plans to make an int64 TryGetNumberField() override for FJsonObject? Or maybe there is one and I'm missing it?

Product Version: UE 4.17
Tags:
more ▼

asked Sep 23 '17 at 10:30 AM in C++ Programming

avatar image

tehhax
196 31 29 50

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I was missing it because it wasn't in FJsonObject. There is an int64 version of FJsonValue's "TryGetNumber"

For example:

 int64 CreatedDate = 0;
 TSharedPtr<FJsonValue> dateValue = ParsedResponse->GetField<EJson::Number>("created_date");
 dateValue->TryGetNumber(CreatedDate);

Posting here and marking as answer for anyone else looking!

more ▼

answered Oct 02 '17 at 07:00 AM

avatar image

tehhax
196 31 29 50

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question