Comments (6)
Hi @lindajoseph01, I haven't verified with a test using your example, but I believe you are missing the {}
around the item in the config
. config
is an array of objects. so it should look like:
...
"steps":[{
"config":[{"repeat(3)", {
"timestamp": "nowTimestamp()",
"system": "BADGE",
"actor": "bob",
"action": "ENTER",
"objects": ["Building 1"],
"location": "45.5,44.3",
"message": "Entered Building 1"
}
}],
...
Try that out and see if that works
from json-data-generator.
Hey @andrewserff Thank you for your response:)
I tried to execute the test as you mentioned. I am getting the following error:
Error reading config: test
com.fasterxml.jackson.databind.JsonMappingException: Unexpected character (',' (code 44)): was expecting a colon to separate field name and value
at [Source: java.io.BufferedInputStream@5b8dfcc1; line: 10, column: 38] (through reference chain: net.acesinc.data.json.generator.workflow.Workflow["steps"]->java.util.ArrayList[0]->net.acesinc.data.json.generator.workflow.WorkflowStep["config"]->java.util.ArrayList[0])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210) ~[jackson-databind-2.5.2.jar:2.5.2]
I used the repeat special function exactly as described in the documentation.I want to create 3 copies of the array in config.
from json-data-generator.
Can you post your full config?
from json-data-generator.
This is an extremely old ticket and I doubt I'll get a response, but I'm having the exact same issue. I want to create a top-level json array:
[
{
...json object from my config
},
{
..json object from my config with different values from functions
}
]
but cannot figure out how to make that happen. I also tried the suggestion above and got the exact same error as @lindajoseph01.
This is my workflow definition based on the suggestion given here (there's nothing of note in the simulation config):
{
"repeatWorkflow": true,
"iterations": 10,
"eventFrequency": 100,
"steps": [
{
"config": [
{
"repeat(10)", {
"customer_id": "uuid()",
"event_type": "SOMETHING_IMPORTANT",
"transaction_id": "uuid()",
"timestamp": "now()",
"properties": {
"casey": "crites"
}
}
}
]
}
]
}
even based on the syntax highlighting, it's not valid json. I've tried a few other things, like using repeat(10)
as the key of the object, but that doesn't work either.
from json-data-generator.
based on the examples and the resources in the repo, my guess is this isn't supported. Everything points to the only arrays you can repeat are not top-level, but somewhere inside your json object.
from json-data-generator.
Yeah, the config
section expects a List<Map<String, Object>>
which wouldn't support top-level arrays.
from json-data-generator.
Related Issues (20)
- Generate JSON web server logs HOT 2
- Any plans to support SQS producer? HOT 1
- Need help to change the configuration file to limit the numbers of record i create
- Integer values within JSON array are not been maintained
- Can't generate array of double HOT 2
- support for Basic Auth in HttpPostLogger
- Writing multiple iterations to a single file HOT 3
- data generator to kafka
- Troubles running default config
- BUG: closing parenthesis ")" breaks parsing arguments HOT 1
- Upgrade jackson-databind to 2.9.10
- Upgrade mqtt library to v1.2.2
- Properties from prev step.
- Not able to generate JSON output from the schema HOT 1
- HTTP-POST error 404 HOT 1
- Main thread never terminates HOT 1
- How to generate multiple pieces of data in one json file instead of one line of data per file HOT 1
- Allow a DataSource to be used to provide values in generated items HOT 1
- Adding custom function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-data-generator.