-
Hi! Thanks again for answering my question in #94 . I've realized that I've generalized too much when posing that question.
I'm not asking you to expand ojg to support the "Set" and "MarshalJSON" methods. Dynamically setting JSON values based on calculations that can only happen after all values have been collected via the JSONPath expression. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Seems like the most direct way is probably best here. Step one is collect the values. Then prepare the value to be set. Finally set the value in the data. In the example it seems that the setter traverses all of the data to calculate a value for setting so it doesn't really make sense to localize it to an individual field that reaches across the data. A similar situation might be converting a slice of strings into a string. That is supported using the recently added Modify() in the jp package. |
Beta Was this translation helpful? Give feedback.
Seems like the most direct way is probably best here. Step one is collect the values. Then prepare the value to be set. Finally set the value in the data. In the example it seems that the setter traverses all of the data to calculate a value for setting so it doesn't really make sense to localize it to an individual field that reaches across the data.
A similar situation might be converting a slice of strings into a string. That is supported using the recently added Modify() in the jp package.